MVP 1.0 (ohne Shop) #1
No files matched your search
@@ -483,6 +483,11 @@ .site-footer {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Endet die Seite mit einer dunklen Fläche, trennt eine feine Linie sie vom Fußbereich. */
|
||||
main:has(> .page-section.scope-dark:last-child) + .site-footer {
|
||||
box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%);
|
||||
}
|
||||
|
||||
.site-footer-inner {
|
||||
display: grid;
|
||||
gap: var(--space-6) var(--space-7);
|
||||
|
||||
+10
-50
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Website-Kopfzeile: Menümodus, mobile Navigation, Untermenüs und kompakter Zustand beim Scrollen.
|
||||
*
|
||||
* Breitenstufen der Kopfzeile (Messung der Desktop-Darstellung an der echten Navigation, unabhängig vom aktuellen Modus):
|
||||
* Breitenstufen der Kopfzeile (Messung inline in header.blade.php, window.lufHeaderMode):
|
||||
* 1. Navigation und Kontozugang mit Beschriftung passen in eine Zeile.
|
||||
* 2. Sonst: Kontozugang nur als Symbol (is-account-compact).
|
||||
* 3. Sonst und immer unter 75 rem: Menümodus (is-menu-mode).
|
||||
@@ -89,62 +89,22 @@ function setupMenu(header) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Breitenstufen: Die Messung steht als window.lufHeaderMode inline direkt nach der Kopfzeile
|
||||
* (components/site/header.blade.php), damit schon der erste Frame stimmt. Hier wird sie bei Größenänderungen,
|
||||
* beim Wechsel über 75 rem und nach dem Laden der Schriften wiederholt.
|
||||
*/
|
||||
function setupMode(header, closeMenu) {
|
||||
const apply = window.lufHeaderMode;
|
||||
const inner = header.querySelector('.site-header-inner');
|
||||
const list = header.querySelector('.site-nav-list');
|
||||
const brand = inner?.querySelector('.brand');
|
||||
const actions = inner?.querySelector('.site-header-actions');
|
||||
const account = actions?.querySelector('.site-account-link');
|
||||
|
||||
if (!inner || !list || !brand || !actions || !account) {
|
||||
if (typeof apply !== 'function' || !inner) {
|
||||
return;
|
||||
}
|
||||
|
||||
const width = (element) => element.getBoundingClientRect().width;
|
||||
const realNav = header.querySelector('.site-nav');
|
||||
|
||||
/*
|
||||
* Misst die Desktop-Darstellung an der echten Navigation: Zustandsklassen werden innerhalb desselben
|
||||
* Aufrufs entfernt, gemessen und wiederhergestellt. Dazwischen wird nicht gezeichnet; es entsteht keine Kopie.
|
||||
*/
|
||||
const measureDesktop = () => {
|
||||
const menuMode = header.classList.contains('is-menu-mode');
|
||||
const accountCompact = header.classList.contains('is-account-compact');
|
||||
header.classList.remove('is-menu-mode', 'is-account-compact');
|
||||
|
||||
const gap = parseFloat(getComputedStyle(inner).columnGap) || 0;
|
||||
const result = {
|
||||
room: inner.clientWidth - width(brand) - 2 * gap - (parseFloat(getComputedStyle(realNav).marginLeft) || 0) - (width(actions) - width(account)),
|
||||
needed: list.scrollWidth,
|
||||
accountFull: width(account),
|
||||
};
|
||||
|
||||
header.classList.toggle('is-menu-mode', menuMode);
|
||||
header.classList.toggle('is-account-compact', accountCompact);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const update = () => {
|
||||
let state = 'menu';
|
||||
|
||||
if (!BASELINE.matches) {
|
||||
const { room, needed, accountFull } = measureDesktop();
|
||||
const accountIcon = parseFloat(getComputedStyle(account).minWidth) || 44;
|
||||
|
||||
if (needed + accountFull <= room) {
|
||||
state = 'full';
|
||||
} else if (needed + accountIcon <= room) {
|
||||
state = 'icon';
|
||||
}
|
||||
}
|
||||
|
||||
header.classList.toggle('is-account-compact', state !== 'full');
|
||||
if ((state === 'menu') !== isMenuMode(header)) {
|
||||
header.classList.toggle('is-menu-mode', state === 'menu');
|
||||
if (state !== 'menu') {
|
||||
closeMenu();
|
||||
}
|
||||
if (apply(header) !== 'menu') {
|
||||
closeMenu();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,5 +52,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{{-- Menümodus vor dem ersten Zeichnen setzen, damit die Navigation auf kleinen Bildschirmen nicht aufblitzt. --}}
|
||||
<script>(function (h) { if (window.matchMedia('(max-width: 74.99rem)').matches) { h.classList.add('is-menu-mode'); } })(document.querySelector('[data-site-header]'));</script>
|
||||
{{--
|
||||
Breitenstufen vor dem ersten Zeichnen setzen (läuft nach dem Laden des Stylesheets, vor dem Zeichnen):
|
||||
full = Navigation und beschrifteter Kontozugang passen in eine Zeile, icon = Kontozugang nur als Symbol,
|
||||
menu = Menümodus (immer unter 75 rem). Gemessen wird die Desktop-Darstellung an der echten Navigation;
|
||||
resources/js/site-nav.js ruft dieselbe Funktion bei Größenänderungen und nach dem Laden der Schriften erneut auf.
|
||||
--}}
|
||||
<script>
|
||||
window.lufHeaderMode = function (h) {
|
||||
var state = 'menu';
|
||||
if (!window.matchMedia('(max-width: 74.99rem)').matches) {
|
||||
var menu = h.classList.contains('is-menu-mode'), compact = h.classList.contains('is-account-compact');
|
||||
h.classList.remove('is-menu-mode', 'is-account-compact');
|
||||
var w = function (e) { return e.getBoundingClientRect().width; };
|
||||
var inner = h.querySelector('.site-header-inner'), nav = h.querySelector('.site-nav'), list = h.querySelector('.site-nav-list');
|
||||
var actions = h.querySelector('.site-header-actions'), account = h.querySelector('.site-account-link');
|
||||
var gap = parseFloat(getComputedStyle(inner).columnGap) || 0;
|
||||
var room = inner.clientWidth - w(h.querySelector('.brand')) - 2 * gap - (parseFloat(getComputedStyle(nav).marginLeft) || 0) - (w(actions) - w(account));
|
||||
var needed = list.scrollWidth, full = w(account), icon = parseFloat(getComputedStyle(account).minWidth) || 44;
|
||||
h.classList.toggle('is-menu-mode', menu);
|
||||
h.classList.toggle('is-account-compact', compact);
|
||||
state = needed + full <= room ? 'full' : (needed + icon <= room ? 'icon' : 'menu');
|
||||
}
|
||||
h.classList.toggle('is-account-compact', state !== 'full');
|
||||
h.classList.toggle('is-menu-mode', state === 'menu');
|
||||
return state;
|
||||
};
|
||||
window.lufHeaderMode(document.querySelector('[data-site-header]'));
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
@php
|
||||
$document = '<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><base target="_blank">'
|
||||
.$stylesheets
|
||||
.'<style>html,body{background:#fff;overflow:hidden}body{margin:0;padding:1rem 1.25rem;min-height:0}main{display:block}</style>'
|
||||
.'<style>html,body{background:#fff;overflow:hidden}html{scrollbar-gutter:auto}body{margin:0;padding:1rem 1.25rem;min-height:0}main{display:block}</style>'
|
||||
.'</head><body><main class="sheet-preview"><div class="section-slot">'.$html.'</div></main></body></html>';
|
||||
@endphp
|
||||
@if (trim($html) === '')
|
||||
|
||||
@@ -48,8 +48,9 @@ public function test_header_keeps_one_box_with_compact_bar_and_sets_the_menu_mod
|
||||
$this->assertMatchesRegularExpression('#<header class="site-header" data-site-header>\s*<div class="site-header-bar">\s*<div class="site-header-inner ui-container">#', $html);
|
||||
$this->assertStringContainsString('class="brand brand-lockup"', $html);
|
||||
$this->assertStringContainsString('class="site-icon-link site-account-link" href="'.route('member.dashboard').'"', $html);
|
||||
// Menümodus wird direkt nach der Kopfzeile gesetzt, nicht erst durch das Modul-Skript.
|
||||
$this->assertMatchesRegularExpression('#</header>\s*<script>\(function \(h\) \{ if \(window\.matchMedia\(\'\(max-width: 74\.99rem\)\'\)\.matches\)#', $html);
|
||||
// Breitenstufen werden direkt nach der Kopfzeile gesetzt, vor dem ersten Zeichnen, nicht erst durch das Modul-Skript.
|
||||
$this->assertMatchesRegularExpression('#</header>\s*<script>\s*window\.lufHeaderMode = function \(h\)#', $html);
|
||||
$this->assertStringContainsString("window.lufHeaderMode(document.querySelector('[data-site-header]'));", $html);
|
||||
}
|
||||
|
||||
public function test_footer_shows_legal_links_in_the_base_row_and_a_decorative_arc(): void
|
||||
|
||||
Reference in new issue
Block a user