Add the row layout component
Plan step 35: <x-row gap align justify wrap stack-below>, children side by side in a pane and stacked under one another below an M3 breakpoint, in the inline direction so a right-to-left document mirrors it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
b677e60876
commit
8de053f15c
@@ -0,0 +1,44 @@
|
||||
{{-- Children side by side, inside a pane; under one another below a breakpoint.
|
||||
|
||||
<x-row gap="space100" justify="end" stack-below="medium">…</x-row>
|
||||
|
||||
`gap` is a spacing token's name, `space25` … `space900` (docs/reference/m3/styles-supplement.md
|
||||
§ Spacing), and none when left out or unknown. `align` places the children across the row:
|
||||
`center` (the default), `start`, `end`, `stretch` or `baseline`. `justify` places them along
|
||||
it: `start` (the default), `center`, `end` or `between`. `wrap` lets them wrap onto more lines.
|
||||
|
||||
`stack-below` names a breakpoint — `medium` (600px), `expanded` (840), `large` (1200) or
|
||||
`extra-large` (1600), M3's in px (docs/reference/m3/foundations.md § Layout → Breakpoints) —
|
||||
below which the row is a column: M3's "reposition" as the window narrows. A stacked row
|
||||
stretches its children unless `align` was given.
|
||||
|
||||
The row runs in the inline direction, so it mirrors in a right-to-left document by itself. It
|
||||
takes `as`, `hide-below` and `hide-from` like every layout component, and the caller's `class`
|
||||
and `style` land on it untouched. Drawn by resources/css/layout/row.css. --}}
|
||||
|
||||
@props([
|
||||
'as' => null,
|
||||
'gap' => null,
|
||||
'align' => null,
|
||||
'justify' => null,
|
||||
'wrap' => false,
|
||||
'stackBelow' => null,
|
||||
'hideBelow' => null,
|
||||
'hideFrom' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$layout = \NoNameWeb\LivewireMaterial\Support\Layout::class;
|
||||
$element = $layout::element($as);
|
||||
|
||||
$attributes = $attributes->merge(array_filter([
|
||||
'data-md-row' => true,
|
||||
'data-md-gap' => $layout::spacing($gap),
|
||||
'data-md-align' => $layout::choice($align, ['center', 'start', 'end', 'stretch', 'baseline']),
|
||||
'data-md-justify' => $layout::choice($justify, ['start', 'center', 'end', 'between']),
|
||||
'data-md-wrap' => $wrap ? true : null,
|
||||
'data-md-stack-below' => $layout::edge($stackBelow),
|
||||
] + $layout::visibility($hideBelow, $hideFrom), fn ($value): bool => $value !== null));
|
||||
@endphp
|
||||
|
||||
<{{ $element }} {{ $attributes }}>{{ $slot }}</{{ $element }}>
|
||||
Reference in New Issue
Block a user