mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
🎨 Add new Flux icons: implement multiple reusable icon components (e.g., hand-raised, hand-thumb-up, heart, hashtag, home) with variant support for improved UI consistency.
This commit is contained in:
56
resources/views/flux/navbar/badge.blade.php
Normal file
56
resources/views/flux/navbar/badge.blade.php
Normal file
@@ -0,0 +1,56 @@
|
||||
@blaze
|
||||
|
||||
@props([
|
||||
'variant' => null,
|
||||
'color' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$class = Flux::classes()
|
||||
->add('text-xs font-medium rounded-sm px-1 py-0.5')
|
||||
/**
|
||||
* We can't compile classes for each color because of variants color to color and Tailwind's JIT compiler.
|
||||
* We instead need to write out each one by hand. Sorry...
|
||||
*/
|
||||
->add($variant === 'solid' ? match ($color) {
|
||||
default => 'text-white dark:text-white bg-zinc-600 dark:bg-zinc-600',
|
||||
'red' => 'text-white dark:text-white bg-red-500 dark:bg-red-600',
|
||||
'orange' => 'text-white dark:text-white bg-orange-500 dark:bg-orange-600',
|
||||
'amber' => 'text-white dark:text-zinc-950 bg-amber-500 dark:bg-amber-500',
|
||||
'yellow' => 'text-white dark:text-zinc-950 bg-yellow-500 dark:bg-yellow-400',
|
||||
'lime' => 'text-white dark:text-white bg-lime-500 dark:bg-lime-600',
|
||||
'green' => 'text-white dark:text-white bg-green-500 dark:bg-green-600',
|
||||
'emerald' => 'text-white dark:text-white bg-emerald-500 dark:bg-emerald-600',
|
||||
'teal' => 'text-white dark:text-white bg-teal-500 dark:bg-teal-600',
|
||||
'cyan' => 'text-white dark:text-white bg-cyan-500 dark:bg-cyan-600',
|
||||
'sky' => 'text-white dark:text-white bg-sky-500 dark:bg-sky-600',
|
||||
'blue' => 'text-white dark:text-white bg-blue-500 dark:bg-blue-600',
|
||||
'indigo' => 'text-white dark:text-white bg-indigo-500 dark:bg-indigo-600',
|
||||
'violet' => 'text-white dark:text-white bg-violet-500 dark:bg-violet-600',
|
||||
'purple' => 'text-white dark:text-white bg-purple-500 dark:bg-purple-600',
|
||||
'fuchsia' => 'text-white dark:text-white bg-fuchsia-500 dark:bg-fuchsia-600',
|
||||
'pink' => 'text-white dark:text-white bg-pink-500 dark:bg-pink-600',
|
||||
'rose' => 'text-white dark:text-white bg-rose-500 dark:bg-rose-600',
|
||||
} : match ($color) {
|
||||
default => 'text-zinc-700 dark:text-zinc-200 bg-zinc-400/15 dark:bg-zinc-400/40',
|
||||
'red' => 'text-red-700 dark:text-red-200 bg-red-400/20 dark:bg-red-400/40',
|
||||
'orange' => 'text-orange-700 dark:text-orange-200 bg-orange-400/20 dark:bg-orange-400/40',
|
||||
'amber' => 'text-amber-700 dark:text-amber-200 bg-amber-400/25 dark:bg-amber-400/40',
|
||||
'yellow' => 'text-yellow-800 dark:text-yellow-200 bg-yellow-400/25 dark:bg-yellow-400/40',
|
||||
'lime' => 'text-lime-800 dark:text-lime-200 bg-lime-400/25 dark:bg-lime-400/40',
|
||||
'green' => 'text-green-800 dark:text-green-200 bg-green-400/20 dark:bg-green-400/40',
|
||||
'emerald' => 'text-emerald-800 dark:text-emerald-200 bg-emerald-400/20 dark:bg-emerald-400/40',
|
||||
'teal' => 'text-teal-800 dark:text-teal-200 bg-teal-400/20 dark:bg-teal-400/40',
|
||||
'cyan' => 'text-cyan-800 dark:text-cyan-200 bg-cyan-400/20 dark:bg-cyan-400/40',
|
||||
'sky' => 'text-sky-800 dark:text-sky-200 bg-sky-400/20 dark:bg-sky-400/40',
|
||||
'blue' => 'text-blue-800 dark:text-blue-200 bg-blue-400/20 dark:bg-blue-400/40',
|
||||
'indigo' => 'text-indigo-700 dark:text-indigo-200 bg-indigo-400/20 dark:bg-indigo-400/40',
|
||||
'violet' => 'text-violet-700 dark:text-violet-200 bg-violet-400/20 dark:bg-violet-400/40',
|
||||
'purple' => 'text-purple-700 dark:text-purple-200 bg-purple-400/20 dark:bg-purple-400/40',
|
||||
'fuchsia' => 'text-fuchsia-700 dark:text-fuchsia-200 bg-fuchsia-400/20 dark:bg-fuchsia-400/40',
|
||||
'pink' => 'text-pink-700 dark:text-pink-200 bg-pink-400/20 dark:bg-pink-400/40',
|
||||
'rose' => 'text-rose-700 dark:text-rose-200 bg-rose-400/20 dark:bg-rose-400/40',
|
||||
});
|
||||
@endphp
|
||||
|
||||
<span {{ $attributes->class($class) }}>{{ $slot }}</span>
|
||||
17
resources/views/flux/navbar/index.blade.php
Normal file
17
resources/views/flux/navbar/index.blade.php
Normal file
@@ -0,0 +1,17 @@
|
||||
@blaze
|
||||
|
||||
@props([
|
||||
'scrollable' => false,
|
||||
'variant' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$classes = Flux::classes()
|
||||
->add('flex items-center gap-1 py-3')
|
||||
->add($scrollable ? ['overflow-x-auto overflow-y-hidden'] : [])
|
||||
;
|
||||
@endphp
|
||||
|
||||
<nav {{ $attributes->class($classes) }} data-flux-navbar>
|
||||
{{ $slot }}
|
||||
</nav>
|
||||
81
resources/views/flux/navbar/item.blade.php
Normal file
81
resources/views/flux/navbar/item.blade.php
Normal file
@@ -0,0 +1,81 @@
|
||||
@php $iconTrailing ??= $attributes->pluck('icon:trailing'); @endphp
|
||||
@php $iconVariant ??= $attributes->pluck('icon:variant'); @endphp
|
||||
|
||||
@aware([ 'variant' ])
|
||||
|
||||
@props([
|
||||
'iconVariant' => 'outline',
|
||||
'iconTrailing' => null,
|
||||
'badgeColor' => null,
|
||||
'variant' => null,
|
||||
'iconDot' => null,
|
||||
'accent' => true,
|
||||
'square' => null,
|
||||
'badge' => null,
|
||||
'icon' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
// Button should be a square if it has no text contents...
|
||||
$square ??= $slot->isEmpty();
|
||||
|
||||
// Size-up icons in square/icon-only buttons...
|
||||
$iconClasses = Flux::classes($square ? 'size-6' : 'size-5');
|
||||
|
||||
$classes = Flux::classes()
|
||||
->add('px-3 h-8 flex items-center rounded-lg')
|
||||
->add('relative') // This is here for the "active" bar at the bottom to be positioned correctly...
|
||||
->add($square ? '' : 'px-2.5!')
|
||||
->add('text-text-secondary')
|
||||
// Styles for when this link is the "current" one...
|
||||
->add('data-current:after:absolute data-current:after:-bottom-3 data-current:after:inset-x-0 data-current:after:h-[2px]')
|
||||
->add([
|
||||
'[--hover-fill:var(--color-bg-elevated)]',
|
||||
])
|
||||
->add(match ($accent) {
|
||||
true => [
|
||||
'hover:text-text-primary',
|
||||
'data-current:text-text-primary hover:data-current:text-text-primary hover:bg-bg-elevated hover:data-current:bg-(--hover-fill)',
|
||||
'data-current:after:bg-orange-primary',
|
||||
],
|
||||
false => [
|
||||
'hover:text-text-primary',
|
||||
'data-current:text-text-primary hover:bg-bg-elevated',
|
||||
'data-current:after:bg-text-primary',
|
||||
],
|
||||
})
|
||||
;
|
||||
@endphp
|
||||
|
||||
<flux:button-or-link :attributes="$attributes->class($classes)" data-flux-navbar-items>
|
||||
<?php if ($icon): ?>
|
||||
<div class="relative">
|
||||
<?php if (is_string($icon) && $icon !== ''): ?>
|
||||
<flux:icon :$icon :variant="$iconVariant" class="{!! $iconClasses !!}" />
|
||||
<?php else: ?>
|
||||
{{ $icon }}
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($iconDot): ?>
|
||||
<div class="absolute top-[-2px] end-[-2px]">
|
||||
<div class="size-[6px] rounded-full bg-orange-primary"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($slot->isNotEmpty()): ?>
|
||||
<div class="{{ $icon ? 'ms-3' : '' }} flex-1 text-sm font-medium leading-none whitespace-nowrap [[data-nav-footer]_&]:hidden [[data-nav-sidebar]_[data-nav-footer]_&]:block" data-content>{{ $slot }}</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_string($iconTrailing) && $iconTrailing !== ''): ?>
|
||||
<flux:icon :icon="$iconTrailing" variant="micro" class="size-4 ms-1" />
|
||||
<?php elseif ($iconTrailing): ?>
|
||||
{{ $iconTrailing }}
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($badge) && $badge !== ''): ?>
|
||||
<?php $badgeAttributes = Flux::attributesAfter('badge:', $attributes, ['color' => $badgeColor, 'class' => 'ms-2']); ?>
|
||||
<flux:navbar.badge :attributes="$badgeAttributes">{{ $badge }}</flux:navbar.badge>
|
||||
<?php endif; ?>
|
||||
</flux:button-or-link>
|
||||
Reference in New Issue
Block a user