Lass auf dem Tablet eine ganz leere Rasterzeile entfallen
Bei vier gleich breiten Plätzen steht das Raster auf dem Tablet als 2 x 2. War die erste Zeile komplett leer, blieb ihr Zeilenabstand als Lücke über dem Inhalt stehen. Eine Zeile, in der alle Plätze leer sind, wird dort jetzt ausgeblendet; die Plätze danach rücken genau eine Zeile nach oben und bleiben in ihrer Spalte. Gefunden durch einen Vergleich aller Raster, Abschnittsbreiten, Abstände und Fensterbreiten (2400 Prüfungen). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
40f8a4afc2
commit
28bd5590bc
5 files changed
+62
-5
No files matched your search
@@ -116,14 +116,25 @@ private function renderSection(array $section, array $cells, int $index, RenderC
|
||||
.' style="object-position: '.e(SectionStyle::FOCUS_POSITIONS[$style['focus']]).'">';
|
||||
}
|
||||
|
||||
// Auf dem Tablet stehen gleich breite Plätze nebeneinander; nur dort behalten leere Plätze ihre Stelle.
|
||||
$tabletColumns = $columns['md'] !== 'minmax(0, 1fr)' ? ' section-grid-tablet-columns' : '';
|
||||
// Auf dem Tablet stehen gleich breite Plätze nebeneinander (zwei oder drei je Zeile); nur dort behalten leere Plätze
|
||||
// ihre Stelle. Eine Zeile, in der alle Plätze leer sind, entfällt auf dem Tablet ganz (sonst bliebe ihr Abstand stehen).
|
||||
$perRow = preg_match('/^repeat\((\d+),/', $columns['md'], $match) === 1 ? (int) $match[1] : 1;
|
||||
$tabletColumns = $perRow > 1 ? ' section-grid-tablet-columns' : '';
|
||||
$emptyRows = [];
|
||||
|
||||
if ($perRow > 1) {
|
||||
foreach (array_chunk(array_keys($cells), $perRow) as $row) {
|
||||
if (array_filter($row, fn (int $position): bool => $cells[$position]['html'] !== '') === []) {
|
||||
$emptyRows = array_merge($emptyRows, $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= '<div class="page-section-inner"><div class="section-grid'.$tabletColumns.'" data-slots="'.count($cells).'"'
|
||||
.' style="--section-cols-lg: '.e($columns['lg']).'; --section-cols-md: '.e($columns['md']).'">';
|
||||
|
||||
foreach ($cells as $cell) {
|
||||
foreach ($cells as $position => $cell) {
|
||||
$html .= $cell['html'] === ''
|
||||
? '<div class="section-slot section-slot-empty" data-units="'.$cell['units'].'" aria-hidden="true"></div>'
|
||||
? '<div class="section-slot section-slot-empty'.(in_array($position, $emptyRows, true) ? ' section-slot-empty-row' : '').'" data-units="'.$cell['units'].'" aria-hidden="true"></div>'
|
||||
: '<div class="section-slot" data-units="'.$cell['units'].'">'.$cell['html'].'</div>';
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user