Skip to content

Commit ac54818

Browse files
committed
feat(theming): Provide body-container- variables through theming
* Provide the body container height, radius and margin as theming variables. * Remove unused old variables (`header-menu-profile-item-height` and `list-max-width`) * Fix comment about breakpoint JS location Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent e8c4374 commit ac54818

3 files changed

Lines changed: 23 additions & 22 deletions

File tree

apps/theming/css/default.css

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
--color-border-maxcontrast: #7d7d7d;
5050
--font-face: system-ui, -apple-system, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
5151
--default-font-size: 15px;
52+
/* 1.5 x font-size for accessibility */
53+
--default-line-height: 24px;
5254
--animation-quick: 100ms;
5355
--animation-slow: 300ms;
5456
/** Border width for input elements such as text fields and selects */
@@ -63,16 +65,18 @@
6365
--default-clickable-area: 34px;
6466
--clickable-area-large: 48px;
6567
--clickable-area-small: 24px;
66-
--default-line-height: 24px;
6768
--default-grid-baseline: 4px;
6869
--header-height: 50px;
70+
--header-menu-item-height: 44px;
6971
--navigation-width: 300px;
7072
--sidebar-min-width: 300px;
7173
--sidebar-max-width: 500px;
72-
--list-min-width: 200px;
73-
--list-max-width: 300px;
74-
--header-menu-item-height: 44px;
75-
--header-menu-profile-item-height: 66px;
74+
/* Border radius of the body container */
75+
--body-container-radius: calc(var(--default-grid-baseline) * 3);
76+
/* Margin of the body container */
77+
--body-container-margin: calc(var(--default-grid-baseline) * 2);
78+
/* Height of the body container to fully fill the view port */
79+
--body-height: calc(100% - env(safe-area-inset-bottom) - var(--header-height) - var(--body-container-margin));
7680
--breakpoint-mobile: 1024px;
7781
--background-invert-if-dark: no;
7882
--background-invert-if-bright: invert(100%);

apps/theming/lib/Themes/DefaultTheme.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public function getCSSVariables(): array {
160160

161161
'--font-face' => "system-ui, -apple-system, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
162162
'--default-font-size' => '15px',
163+
// 1.5 * font-size for accessibility
164+
'--default-line-height' => '24px',
163165

164166
// TODO: support "(prefers-reduced-motion)"
165167
'--animation-quick' => '100ms',
@@ -179,20 +181,24 @@ public function getCSSVariables(): array {
179181
'--default-clickable-area' => '34px',
180182
'--clickable-area-large' => '48px',
181183
'--clickable-area-small' => '24px',
182-
'--default-line-height' => '24px',
184+
183185
'--default-grid-baseline' => '4px',
184186

185187
// various structure data
186188
'--header-height' => '50px',
189+
'--header-menu-item-height' => '44px',
187190
'--navigation-width' => '300px',
188191
'--sidebar-min-width' => '300px',
189192
'--sidebar-max-width' => '500px',
190-
'--list-min-width' => '200px',
191-
'--list-max-width' => '300px',
192-
'--header-menu-item-height' => '44px',
193-
'--header-menu-profile-item-height' => '66px',
194193

195-
// mobile. Keep in sync with core/js/js.js
194+
// Border radius of the body container
195+
'--body-container-radius' => 'calc(var(--default-grid-baseline) * 3)',
196+
// Margin of the body container
197+
'--body-container-margin' => 'calc(var(--default-grid-baseline) * 2)',
198+
// Height of the body container to fully fill the view port
199+
'--body-height' => 'calc(100% - env(safe-area-inset-bottom) - var(--header-height) - var(--body-container-margin))',
200+
201+
// mobile. Keep in sync with core/src/init.js
196202
'--breakpoint-mobile' => '1024px',
197203
'--background-invert-if-dark' => 'no',
198204
'--background-invert-if-bright' => 'invert(100%)',

core/css/apps.scss

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,8 @@
77
@use 'sass:math';
88
@import 'functions';
99

10-
11-
:root {
12-
/* - 2px is required for making it look nice */
13-
--border-radius-rounded: calc(var(--default-clickable-area) / 2 + var(--default-grid-baseline) * 2 - 2px);
14-
15-
--body-container-radius: calc(var(--default-grid-baseline) * 3);
16-
--body-container-margin: calc(var(--default-grid-baseline) * 2);
17-
--body-height: calc(100% - env(safe-area-inset-bottom) - 50px - var(--body-container-margin));
18-
}
19-
20-
@media screen and (max-width: variables.$breakpoint-mobile) {
10+
@media screen and (max-width: var(--breakpoint-mobile)) {
11+
// Make the body full width on mobile
2112
:root {
2213
--body-container-margin: 0px;
2314
--body-container-radius: 0px;

0 commit comments

Comments
 (0)