-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ui): create the first branded Blade component set #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @props([ | ||
| 'href', | ||
| 'label', | ||
| 'icon', | ||
| 'current' => false, | ||
| ]) | ||
|
|
||
| <a | ||
| href="{{ $href }}" | ||
| @class([ | ||
| 'flex items-center gap-3 rounded-md px-3 py-2.5 text-sm transition-colors', | ||
| 'bg-main font-medium text-copy' => $current, | ||
| 'text-muted hover:bg-main hover:text-copy' => ! $current, | ||
| ]) | ||
| > | ||
| <span class="flex size-8 items-center justify-center rounded-md bg-main text-muted"> | ||
| <x-dynamic-component :component="$icon" class="size-4" /> | ||
| </span> | ||
| <span>{{ $label }}</span> | ||
| </a> | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||||
| @props([ | ||||||||
| 'href', | ||||||||
| 'label', | ||||||||
| 'icon', | ||||||||
| 'current' => false, | ||||||||
| ]) | ||||||||
|
|
||||||||
| <a | ||||||||
| href="{{ $href }}" | ||||||||
|
||||||||
| href="{{ $href }}" | |
| href="{{ $href }}" | |
| @if ($current) aria-current="page" @endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| @props([ | ||
| 'name' => null, | ||
| 'initials' => null, | ||
| 'size' => 'md', | ||
| ]) | ||
|
|
||
| @php | ||
| $sizeClasses = [ | ||
| 'sm' => 'size-8 text-xs', | ||
| 'md' => 'size-10 text-sm', | ||
| 'lg' => 'size-12 text-base', | ||
| ]; | ||
| @endphp | ||
|
|
||
| <span {{ $attributes->class(['inline-flex items-center justify-center rounded-md bg-accent-soft font-medium text-accent-strong', $sizeClasses[$size] ?? $sizeClasses['md']]) }}> | ||
| {{ $initials ?? \Illuminate\Support\Str::of((string) $name)->trim()->explode(' ')->filter()->take(2)->map(fn (string $part): string => mb_strtoupper(mb_substr($part, 0, 1)))->implode('') ?: '?' }} | ||
| </span> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| @props([ | ||
| 'tone' => 'neutral', | ||
| ]) | ||
|
|
||
| @php | ||
| $toneClasses = [ | ||
| 'neutral' => 'bg-main text-muted', | ||
| 'accent' => 'bg-accent-soft text-accent-strong', | ||
| 'success' => 'bg-emerald-500/12 text-emerald-700 dark:text-emerald-300', | ||
| ]; | ||
| @endphp | ||
|
|
||
| <span {{ $attributes->class(['inline-flex items-center rounded-md px-2 py-1 text-xs font-medium', $toneClasses[$tone] ?? $toneClasses['neutral']]) }}> | ||
| {{ $slot }} | ||
| </span> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @props([ | ||
| 'type' => 'button', | ||
| 'variant' => 'primary', | ||
| ]) | ||
|
|
||
| @php | ||
| $variantClasses = [ | ||
| 'primary' => 'bg-accent text-white hover:bg-accent-strong', | ||
| 'secondary' => 'bg-main text-copy hover:bg-panel', | ||
| 'ghost' => 'bg-transparent text-copy hover:bg-main', | ||
| ]; | ||
|
|
||
| $baseClasses = 'inline-flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50'; | ||
| @endphp | ||
|
|
||
| <button | ||
| type="{{ $type }}" | ||
| {{ $attributes->class([$baseClasses, $variantClasses[$variant] ?? $variantClasses['primary']]) }} | ||
| > | ||
| {{ $slot }} | ||
| </button> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||
| @props([ | ||||||
| 'label' => 'Menu', | ||||||
| ]) | ||||||
|
|
||||||
| <details {{ $attributes->class(['group relative']) }}> | ||||||
| <summary class="list-none rounded-md bg-main px-3 py-2 text-sm font-medium text-copy marker:hidden"> | ||||||
|
||||||
| <summary class="list-none rounded-md bg-main px-3 py-2 text-sm font-medium text-copy marker:hidden"> | |
| <summary class="list-none rounded-md bg-main px-3 py-2 text-sm font-medium text-copy"> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @props([ | ||
| 'label' => null, | ||
| 'error' => null, | ||
| ]) | ||
|
|
||
| @php | ||
| $fieldClasses = 'block w-full rounded-md border-0 bg-main px-3 py-2 text-sm text-copy shadow-none ring-1 ring-inset ring-transparent transition placeholder:text-muted focus:outline-none focus:ring-2 focus:ring-accent'; | ||
| @endphp | ||
|
|
||
| <label class="block space-y-2"> | ||
| @if ($label) | ||
| <span class="text-sm font-medium text-copy">{{ $label }}</span> | ||
| @endif | ||
|
|
||
| <input {{ $attributes->class([$fieldClasses]) }}> | ||
|
|
||
| @if ($error) | ||
| <span class="text-sm text-red-500">{{ $error }}</span> | ||
| @endif | ||
|
Comment on lines
+15
to
+19
|
||
| </label> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||||||
| @props([ | ||||||||||||||||||||||||||||||||||
| 'title' => null, | ||||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| <div {{ $attributes->class(['rounded-md bg-panel p-5']) }}> | ||||||||||||||||||||||||||||||||||
| @if ($title) | ||||||||||||||||||||||||||||||||||
| <h2 class="text-base font-semibold text-copy">{{ $title }}</h2> | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+7
|
||||||||||||||||||||||||||||||||||
| <div {{ $attributes->class(['rounded-md bg-panel p-5']) }}> | |
| @if ($title) | |
| <h2 class="text-base font-semibold text-copy">{{ $title }}</h2> | |
| @php | |
| $titleId = $title ? 'modal-title-' . uniqid() : null; | |
| @endphp | |
| <div | |
| role="dialog" | |
| aria-modal="true" | |
| @if ($titleId) aria-labelledby="{{ $titleId }}" @endif | |
| tabindex="-1" | |
| {{ $attributes->class(['rounded-md bg-panel p-5']) }} | |
| > | |
| @if ($title) | |
| <h2 id="{{ $titleId }}" class="text-base font-semibold text-copy">{{ $title }}</h2> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| @props([ | ||
| 'eyebrow' => null, | ||
| 'title' => null, | ||
| 'description' => null, | ||
| 'actions' => null, | ||
| ]) | ||
|
|
||
| <header {{ $attributes->class(['space-y-3']) }}> | ||
| @if ($eyebrow) | ||
| <p class="text-sm font-medium uppercase text-muted">{{ $eyebrow }}</p> | ||
| @endif | ||
|
|
||
| @if ($title) | ||
| <h1 class="max-w-3xl text-3xl font-semibold text-copy">{{ $title }}</h1> | ||
| @endif | ||
|
|
||
| @if ($description) | ||
| <p class="max-w-3xl text-base leading-7 text-muted">{{ $description }}</p> | ||
| @endif | ||
|
|
||
| @if ($actions) | ||
| <div class="flex flex-wrap items-center gap-3"> | ||
| {{ $actions }} | ||
| </div> | ||
| @endif | ||
| </header> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @props([ | ||
| 'title' => null, | ||
| 'subtitle' => null, | ||
| ]) | ||
|
|
||
| <section {{ $attributes->class(['rounded-md bg-panel px-5 py-5']) }}> | ||
| @if ($title || $subtitle) | ||
| <header class="space-y-1"> | ||
| @if ($title) | ||
| <h2 class="text-base font-semibold text-copy">{{ $title }}</h2> | ||
| @endif | ||
|
|
||
| @if ($subtitle) | ||
| <p class="text-sm text-muted">{{ $subtitle }}</p> | ||
| @endif | ||
| </header> | ||
| @endif | ||
|
|
||
| {{ $slot }} | ||
| </section> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| @props([ | ||
| 'label' => null, | ||
| 'error' => null, | ||
| ]) | ||
|
|
||
| @php | ||
| $fieldClasses = 'block w-full rounded-md border-0 bg-main px-3 py-2 text-sm text-copy shadow-none ring-1 ring-inset ring-transparent transition focus:outline-none focus:ring-2 focus:ring-accent'; | ||
| @endphp | ||
|
|
||
| <label class="block space-y-2"> | ||
| @if ($label) | ||
| <span class="text-sm font-medium text-copy">{{ $label }}</span> | ||
| @endif | ||
|
|
||
| <select {{ $attributes->class([$fieldClasses]) }}> | ||
| {{ $slot }} | ||
| </select> | ||
|
|
||
| @if ($error) | ||
|
Comment on lines
+15
to
+19
|
||
| <span class="text-sm text-red-500">{{ $error }}</span> | ||
| @endif | ||
| </label> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @props([ | ||
| 'label' => null, | ||
| 'error' => null, | ||
| ]) | ||
|
|
||
| @php | ||
| $fieldClasses = 'block w-full rounded-md border-0 bg-main px-3 py-2 text-sm text-copy shadow-none ring-1 ring-inset ring-transparent transition placeholder:text-muted focus:outline-none focus:ring-2 focus:ring-accent'; | ||
| @endphp | ||
|
|
||
| <label class="block space-y-2"> | ||
| @if ($label) | ||
| <span class="text-sm font-medium text-copy">{{ $label }}</span> | ||
| @endif | ||
|
|
||
| <textarea {{ $attributes->class([$fieldClasses]) }}></textarea> | ||
|
|
||
| @if ($error) | ||
| <span class="text-sm text-red-500">{{ $error }}</span> | ||
| @endif | ||
|
Comment on lines
+15
to
+19
|
||
| </label> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding
aria-currentwhen$currentis true (e.g.,aria-current="page") so the active context nav item is announced correctly to screen readers, not just styled visually.