feat(nav): shared sub-tabs component for settings and kitchen

Extracts the tab-bar UI into a reusable renderSubTabs() utility
(public/utils/sub-tabs.js + public/styles/sub-tabs.css) so all
sub-module navigation shares one implementation and visual style.

- Settings: replaces template-literal <nav class="settings-tabs">
  with renderSubTabs(); tabs now show icon + label (pill-style),
  group separators via separatorBefore, panel switching via onChange
- Kitchen: renderKitchenTabsBar() becomes a thin wrapper around
  renderSubTabs(); kitchen-tabs.css keeps only layout adjustment rules
- CSS: kitchen-tab* rules removed from kitchen-tabs.css,
  settings-tab-btn* rules removed from settings.css; both now
  inherit from sub-tabs.css
- tokens.css: adds --sub-tabs-height (52px default;
  kitchen overrides to --kitchen-tabs-height: 56px)
- test-browser-loader.mjs: resolves browser-absolute /utils/*.js
  imports to public/ directory for Node test compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ulas Kalayci
2026-05-06 07:33:54 +02:00
parent c465713418
commit c4cb52d042
9 changed files with 236 additions and 220 deletions
+4 -59
View File
@@ -1,66 +1,11 @@
/* Modul: Kitchen Tabs Bar
* Sticky Segment-Control für Mahlzeiten/Rezepte/Einkauf + Sub-Modul Layout-Fixes
* Layout-Fixes für Mahlzeiten/Rezepte/Einkauf bei aktiver Sub-Tab-Leiste.
* Tab-Styles kommen aus sub-tabs.css; hier nur Kitchen-spezifische Overrides.
*/
/* Höhe auf --kitchen-tabs-height überschreiben (56px statt Standard 52px) */
.kitchen-tabs-bar {
display: flex;
gap: var(--space-1);
padding: var(--space-2) var(--space-4);
height: var(--kitchen-tabs-height);
box-sizing: border-box;
position: sticky;
top: 0;
z-index: var(--z-sticky);
background-color: var(--color-bg);
border-bottom: 1px solid var(--color-border-subtle);
overflow-x: auto;
scrollbar-width: none;
-ms-overflow-style: none;
flex-shrink: 0;
}
.kitchen-tabs-bar::-webkit-scrollbar {
display: none;
}
.kitchen-tab {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: 0 var(--space-3);
height: var(--target-base);
border-radius: var(--radius-full);
border: none;
background: transparent;
color: var(--color-text-secondary);
font-family: inherit;
font-size: var(--text-sm);
font-weight: var(--font-weight-medium);
cursor: pointer;
white-space: nowrap;
flex-shrink: 0;
transition: background-color var(--transition-fast), color var(--transition-fast);
-webkit-tap-highlight-color: transparent;
}
.kitchen-tab:active {
transform: scale(0.96);
transition-duration: 0.06s;
}
.kitchen-tab--active {
background-color: color-mix(in srgb, var(--active-module-accent, var(--color-accent)) 14%, transparent);
color: var(--active-module-accent, var(--color-accent));
}
.kitchen-tab__icon {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.kitchen-tab__label {
line-height: 1;
--sub-tabs-height: var(--kitchen-tabs-height);
}
/* Mahlzeiten: sticky day-header unterhalb der Tab-Leiste */
+3 -80
View File
@@ -43,89 +43,12 @@
}
/* --------------------------------------------------------
Tab-Navigation
Sub-Tab-Navigation (via shared sub-tabs.css)
-------------------------------------------------------- */
.settings-tabs {
display: flex;
flex-wrap: nowrap;
gap: 0;
overflow-x: auto;
scrollbar-width: none;
-webkit-overflow-scrolling: touch;
border-bottom: 1px solid var(--color-border);
/* Abstand zwischen Tab-Leiste und erstem Panel-Inhalt */
.settings-page .sub-tabs-bar {
margin-bottom: var(--space-6);
position: sticky;
top: 0;
background: var(--color-bg);
z-index: 10;
padding-top: var(--space-1);
}
.settings-tabs::-webkit-scrollbar {
display: none;
}
.settings-tab-btn {
flex-shrink: 0;
padding: var(--space-3) clamp(var(--space-2), 1.3vw, var(--space-4));
border: none;
border-bottom: 2px solid transparent;
background: transparent;
color: var(--color-text-secondary);
font-size: var(--text-sm);
font-weight: var(--font-weight-medium);
cursor: pointer;
transition: color var(--transition-fast), border-color var(--transition-fast);
min-height: 44px;
white-space: nowrap;
margin-bottom: -1px;
}
.settings-tab-btn:hover {
color: var(--color-text-primary);
}
.settings-tab-btn--active {
color: var(--color-accent);
border-bottom-color: var(--color-accent);
}
/* --------------------------------------------------------
Visuelle Tab-Gruppierung (Vorschlag B)
-------------------------------------------------------- */
/* Trennlinie vor Sync-Gruppe */
.settings-tab-btn[data-group="sync"]::before {
content: '';
position: absolute;
left: -8px;
top: 20%;
height: 60%;
width: 2px;
background: var(--color-border);
}
/* Trennlinie vor Personal-Gruppe */
.settings-tab-btn[data-group="personal"]::before {
content: '';
position: absolute;
left: -8px;
top: 20%;
height: 60%;
width: 2px;
background: var(--color-border);
}
/* Trennlinie vor Admin-Gruppe */
.settings-tab-btn[data-group="admin"]::before {
content: '';
position: absolute;
left: -8px;
top: 20%;
height: 60%;
width: 2px;
background: var(--color-border);
}
/* --------------------------------------------------------
+75
View File
@@ -0,0 +1,75 @@
/* Sub-Tabs Bar — shared pill-style segment control
* Used by kitchen modules, settings, and any future sub-module navigation.
* Height: --sub-tabs-height (default from tokens.css); override per context.
*/
.sub-tabs-bar {
display: flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-2) var(--space-4);
height: var(--sub-tabs-height);
box-sizing: border-box;
position: sticky;
top: 0;
z-index: var(--z-sticky);
background-color: var(--color-bg);
border-bottom: 1px solid var(--color-border-subtle);
overflow-x: auto;
scrollbar-width: none;
-ms-overflow-style: none;
flex-shrink: 0;
}
.sub-tabs-bar::-webkit-scrollbar {
display: none;
}
.sub-tab {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: 0 var(--space-3);
height: var(--target-base);
border-radius: var(--radius-full);
border: none;
background: transparent;
color: var(--color-text-secondary);
font-family: inherit;
font-size: var(--text-sm);
font-weight: var(--font-weight-medium);
cursor: pointer;
white-space: nowrap;
flex-shrink: 0;
transition: background-color var(--transition-fast), color var(--transition-fast);
-webkit-tap-highlight-color: transparent;
}
.sub-tab:active {
transform: scale(0.96);
transition-duration: 0.06s;
}
.sub-tab--active {
background-color: color-mix(in srgb, var(--active-module-accent, var(--color-accent)) 14%, transparent);
color: var(--active-module-accent, var(--color-accent));
}
.sub-tab__icon {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.sub-tab__label {
line-height: 1;
}
/* Vertical divider between tab groups */
.sub-tabs-separator {
width: 1px;
height: 20px;
background: var(--color-border);
flex-shrink: 0;
margin: 0 var(--space-1);
}
+1
View File
@@ -351,6 +351,7 @@
--content-max-width: 1280px;
--content-max-width-narrow: 720px;
--cal-hour-height: 56px;
--sub-tabs-height: 52px;
--kitchen-tabs-height: 56px;
/* --------------------------------------------------------