<?phpuse Illuminate\Pagination\LengthAwarePaginator;use Livewire\Attributes\Computed;use Livewire\Component;use Livewire\WithPagination;new class extends Component { use WithPagination; #[Computed] public function products(): LengthAwarePaginator { return new LengthAwarePaginator(items: [ ['brand' => 'Noren', 'name' => 'H6 Pro Wireless Noise-Cancelling Over-Ear Headphones', 'image' => 'graphite', 'rating' => 4.7, 'reviews' => 326, 'price' => '$199.99', 'was' => '$279.99', 'trending' => true], ['brand' => 'Nova', 'name' => 'N40 Studio Wireless Over-Ear Noise-Cancelling Headphones', 'image' => 'sand', 'rating' => 4.4, 'reviews' => 638, 'price' => '$129.00', 'was' => '$159.99', 'trending' => true], ['brand' => 'Echo', 'name' => 'Studio One Adaptive Noise-Cancelling Headphones', 'image' => 'silver', 'rating' => 4.5, 'reviews' => 227, 'price' => '$149.99', 'was' => null, 'trending' => false], ['brand' => 'Amplitude', 'name' => 'Atlas Pro High-Fidelity Wireless Over-Ear Headphones', 'image' => 'midnight', 'rating' => 4.8, 'reviews' => 428, 'price' => '$325.00', 'was' => null, 'trending' => false], ['brand' => 'Auren', 'name' => 'Reference 45 Premium Wireless Over-Ear Headphones', 'image' => 'onyx', 'rating' => 4.5, 'reviews' => 209, 'price' => '$277.99', 'was' => null, 'trending' => false], ['brand' => 'Resona', 'name' => 'Arc One Immersive Wireless Over-Ear Headphones', 'image' => 'charcoal', 'rating' => 4.3, 'reviews' => 198, 'price' => '$176.99', 'was' => null, 'trending' => false], ['brand' => 'Vela Audio', 'name' => 'Studio N7 Premium Wireless Over-Ear Headphones', 'image' => 'red', 'rating' => 4.6, 'reviews' => 185, 'price' => '$248.99', 'was' => null, 'trending' => false], ['brand' => 'Oryn', 'name' => 'QuietForm 40 Adaptive Noise-Cancelling Headphones', 'image' => 'sky-blue', 'rating' => 4.7, 'reviews' => 157, 'price' => '$160.99', 'was' => null, 'trending' => false], ['brand' => 'Sona', 'name' => 'Horizon ANC Everyday Wireless Over-Ear Headphones', 'image' => 'lavender', 'rating' => 4.2, 'reviews' => 126, 'price' => '$119.99', 'was' => null, 'trending' => false], ['brand' => 'Eiden Audio', 'name' => 'Forma X5 Studio Wireless Over-Ear Noise-Cancelling Headphones', 'image' => 'midnight', 'rating' => 4.4, 'reviews' => 101, 'price' => '$185.99', 'was' => null, 'trending' => false], ['brand' => 'Noven', 'name' => 'Airframe 35 Lightweight Wireless Over-Ear Headphones', 'image' => 'midnight', 'rating' => 4.3, 'reviews' => 85, 'price' => '$277.99', 'was' => null, 'trending' => false], ['brand' => 'Luma Audio', 'name' => 'Luma Audio Halo Pro Spatial Audio Wireless Headphones', 'image' => 'midnight', 'rating' => 4.8, 'reviews' => 64, 'price' => '$127.99', 'was' => null, 'trending' => false], ], total: 127, perPage: 12, currentPage: 1); } #[Computed] public function cartItems(): array { return [ ['name' => 'Oryn QuietForm 40 Adaptive Noise-Cancelling Headphones', 'image' => 'sky-blue', 'color' => 'Sky blue', 'price' => '$160.99'], ['name' => 'Vela Audio Studio N7 Premium Wireless Over-Ear Headphones', 'image' => 'red', 'color' => 'Red', 'price' => '$248.99'], ]; } #[Computed] public function filters(): array { return [ 'Battery life' => ['up to 20h' => 34, '20h - 30h' => 62, '30h - 40h' => 9, '40h - 50h' => 15], 'Brand' => ['All' => 127, 'Noren' => 24, 'Nova' => 14, 'Echo' => 11, 'Amplitude' => 9], ]; } #[Computed] public function colors(): array { return ['Black' => '#27272a', 'Silver' => '#d4d4d8', 'Blue' => '#3b82f6', 'Gold' => '#b59410', 'Red' => '#d13b38', 'Mauve' => '#aea0ac']; } #[Computed] public function moreFilters(): array { return [ 'Availability' => ['In stock', 'Ships in 2 days', 'Pre-order'], 'Features' => ['Multipoint pairing', 'Spatial audio', 'Foldable design'], 'Weight' => ['Under 250g', '250g - 300g', 'Over 300g'], 'Reviews' => ['4 stars & up', '3 stars & up'], 'Deals' => ['Trending deals', 'Bundles'], ]; }};?>{{-- This standalone demo keeps its store header inline. In a production app, move the header into your storefront layout. --}}<div class="min-h-dvh bg-white dark:bg-zinc-950"> <header class="bg-zinc-50 dark:bg-zinc-900"> <div class="flex h-11 items-center justify-between gap-4 bg-zinc-950 px-4 text-sm font-medium text-white/70 sm:px-6 lg:px-12 dark:bg-white dark:text-zinc-500"> <div class="flex items-center gap-2"> <flux:icon.tag variant="mini" /> App Exclusive · Save 10% </div> <div class="flex items-center gap-6"> <a href="#" class="flex items-center gap-2 hover:text-white dark:hover:text-zinc-800"> <flux:icon.map-pin variant="mini" /> <span class="max-sm:sr-only">Locations</span> </a> <a href="#" class="flex items-center gap-2 hover:text-white dark:hover:text-zinc-800"> <flux:icon.chat-bubble-left-right variant="mini" /> <span class="max-sm:sr-only">Help</span> </a> </div> </div> <div class="flex h-18 items-center gap-4 border-b border-zinc-200 px-4 sm:gap-8 sm:px-6 lg:px-12 dark:border-white/10"> <flux:brand href="#" logo="https://fluxui.dev/img/demos/shop/logo.svg" logo:dark="https://fluxui.dev/img/demos/shop/logo-dark.svg" name="AURAL" alt="Aural" class="max-sm:hidden" /> <flux:brand href="#" logo="https://fluxui.dev/img/demos/shop/logo.svg" logo:dark="https://fluxui.dev/img/demos/shop/logo-dark.svg" alt="Aural" class="sm:hidden" /> <flux:input icon="magnifying-glass" value="wireless headphones" clearable placeholder="Search products" aria-label="Search products" class="max-w-lg" /> <div class="ms-auto flex items-center gap-4"> <flux:dropdown align="end"> <flux:avatar as="button" src="https://fluxui.dev/img/demos/shop/avatar.jpg" name="Liam Carter" size="sm" circle aria-label="Account menu" /> <flux:menu> <flux:menu.item icon="user">Account</flux:menu.item> <flux:menu.item icon="list-bullet">My orders</flux:menu.item> <flux:menu.item icon="heart">Wishlist</flux:menu.item> <flux:menu.separator /> <flux:menu.item icon="arrow-right-start-on-rectangle">Logout</flux:menu.item> </flux:menu> </flux:dropdown> <flux:separator vertical class="my-2 max-sm:hidden" /> <flux:navbar class="-me-2"> <flux:dropdown align="end"> <flux:navbar.item icon="shopping-bag" badge="2" aria-label="Shopping cart" /> <flux:popover class="flex w-80 flex-col gap-4 sm:w-md"> <flux:heading size="lg">Shopping cart</flux:heading> @foreach ($this->cartItems as $item) <flux:separator variant="subtle" /> <div class="flex gap-4"> <div class="flex size-20 shrink-0 items-center justify-center rounded-lg border border-zinc-200 bg-white dark:border-white/10 dark:bg-white/5"> <img src="https://fluxui.dev/img/demos/shop/{{ $item['image'] }}.webp" alt="" class="size-16"> </div> <div class="flex min-w-0 flex-1 flex-col gap-2"> <div class="flex justify-between gap-4"> <flux:heading>{{ $item['name'] }}</flux:heading> <flux:heading>{{ $item['price'] }}</flux:heading> </div> <div class="flex items-center gap-2"> <flux:text>{{ $item['color'] }}</flux:text> <flux:badge color="green" size="sm">In stock</flux:badge> </div> <div class="flex flex-wrap items-center justify-between gap-2"> <div class="-ms-2 flex gap-2"> <flux:button variant="subtle" size="sm" icon="bookmark" class="max-sm:hidden">Save for later</flux:button> <flux:button variant="subtle" size="sm" icon="trash">Remove</flux:button> </div> <div class="w-24"> <flux:input.group> <flux:button size="sm" icon="minus" aria-label="Decrease quantity" /> <flux:input size="sm" value="1" readonly aria-label="Quantity" class:input="text-center" /> <flux:button size="sm" icon="plus" aria-label="Increase quantity" /> </flux:input.group> </div> </div> </div> </div> @endforeach <flux:separator variant="subtle" /> <div class="space-y-2"> <div class="flex justify-between"><flux:heading>Subtotal</flux:heading> <flux:heading>$409.98</flux:heading></div> <div class="flex justify-between"><flux:text>Shipping</flux:text> <flux:text>$5.99</flux:text></div> <div class="flex justify-between"><flux:text>Taxes</flux:text> <flux:text>Calculated at checkout</flux:text></div> </div> <flux:separator variant="subtle" /> <div class="flex justify-between"><flux:heading>Estimated total</flux:heading> <flux:heading>$415.97</flux:heading></div> </flux:popover> </flux:dropdown> </flux:navbar> </div> </div> <div class="flex items-center justify-between gap-8 border-b border-zinc-200 px-4 sm:px-6 lg:px-12 dark:border-white/10"> <flux:navbar scrollable aria-label="Categories" class="-ms-3"> @foreach (['All', 'Headphones', 'Earbuds', 'Speakers', 'Soundbars', 'Turntables', 'Amplifiers', 'Accessories', 'Other', 'Deals'] as $category) <flux:navbar.item href="#">{{ $category }}</flux:navbar.item> @endforeach </flux:navbar> <flux:navbar class="-me-3 max-md:hidden"> <flux:navbar.item icon="list-bullet" href="#">My orders</flux:navbar.item> <flux:navbar.item icon="heart" href="#">Wishlist</flux:navbar.item> </flux:navbar> </div> </header> <div class="flex"> <flux:sidebar collapsible="mobile" class="w-80 border-e border-zinc-200 bg-zinc-50 px-6 py-8 lg:px-12 dark:border-white/10 dark:bg-zinc-900"> <div class="flex items-center justify-between lg:hidden"> <flux:heading size="lg">Filters</flux:heading> <flux:sidebar.collapse /> </div> <flux:select label="Category"> <flux:select.option>All headphones</flux:select.option> <flux:select.option>Over-ear</flux:select.option> <flux:select.option>On-ear</flux:select.option> <flux:select.option>Studio monitors</flux:select.option> </flux:select> <div> <flux:field> <flux:label> Price range <x-slot name="trailing"> <flux:link href="#" variant="subtle" class="text-xs">Reset</flux:link> </x-slot> </flux:label> <flux:slider range value="55,345" min="0" max="380" step="5" /> </flux:field> <div class="mt-4 flex gap-4"> <flux:input value="$55" aria-label="Minimum price" /> <flux:input value="$345" aria-label="Maximum price" /> </div> </div> <flux:accordion class="border-t border-zinc-200 pt-4 dark:border-white/10"> @foreach ($this->filters as $heading => $options) <flux:accordion.item expanded> <flux:accordion.heading>{{ $heading }}</flux:accordion.heading> <flux:accordion.content class="space-y-3"> @foreach ($options as $label => $count) <div class="flex items-center justify-between"> <flux:checkbox :$label /> <flux:text>{{ $count }}</flux:text> </div> @endforeach <flux:button variant="ghost" size="sm" icon="chevron-down" inset="left">Show more</flux:button> </flux:accordion.content> </flux:accordion.item> @endforeach <flux:accordion.item expanded> <flux:accordion.heading>Color</flux:accordion.heading> <flux:accordion.content> <flux:checkbox.group variant="pills" aria-label="Color"> @foreach ($this->colors as $color => $hex) <flux:checkbox :value="$color"> <span class="size-3 rounded-full" style="background-color: {{ $hex }}"></span> {{ $color }} </flux:checkbox> @endforeach </flux:checkbox.group> </flux:accordion.content> </flux:accordion.item> @foreach ($this->moreFilters as $heading => $options) <flux:accordion.item> <flux:accordion.heading>{{ $heading }}</flux:accordion.heading> <flux:accordion.content> <flux:checkbox.group :aria-label="$heading"> @foreach ($options as $option) <flux:checkbox :label="$option" /> @endforeach </flux:checkbox.group> </flux:accordion.content> </flux:accordion.item> @endforeach </flux:accordion> </flux:sidebar> <main class="@container min-w-0 flex-1 px-4 py-8 sm:px-6 lg:px-12"> <div class="flex flex-wrap items-center justify-between gap-4"> <flux:heading level="1" size="lg">127 results for “wireless headphones”</flux:heading> <div class="flex items-center gap-2"> <flux:sidebar.toggle icon="adjustments-horizontal" class="lg:hidden" /> <flux:select variant="listbox" size="sm" prefix="Sort by" class="w-fit"> <flux:select.option selected>Best selling</flux:select.option> <flux:select.option>Price: low to high</flux:select.option> <flux:select.option>Price: high to low</flux:select.option> <flux:select.option>Top rated</flux:select.option> <flux:select.option>Most reviewed</flux:select.option> </flux:select> </div> </div> <flux:checkbox.group variant="pills" aria-label="Features" class="mt-6"> @foreach (['Wireless', 'Noise Cancelling', 'Bluetooth', 'Water Resistant', 'On Sale', 'In Stock'] as $feature) <flux:checkbox :label="$feature" /> @endforeach </flux:checkbox.group> <div class="mt-8 grid gap-x-6 gap-y-12 @lg:grid-cols-2 @3xl:grid-cols-3"> @foreach ($this->products as $product) <div class="flex flex-col gap-4"> <div class="relative flex h-50 items-center justify-center rounded-xl bg-zinc-50 dark:bg-zinc-900"> <img src="https://fluxui.dev/img/demos/shop/{{ $product['image'] }}.webp" alt="{{ $product['brand'] }} {{ $product['name'] }}" class="size-36"> <div class="absolute inset-x-3 top-3 flex items-start"> @if ($product['trending']) <flux:badge color="blue">Trending deal</flux:badge> @endif <flux:button icon="heart" icon:variant="outline" size="sm" aria-label="Add to wishlist" class="ms-auto" /> </div> </div> <div class="flex flex-1 flex-col gap-3"> <div> <flux:text>{{ $product['brand'] }}</flux:text> <flux:heading size="lg" class="mt-1">{{ $product['name'] }}</flux:heading> </div> <div class="flex items-center gap-2"> <div class="flex" role="img" aria-label="Rated {{ $product['rating'] }} out of 5"> @foreach (range(1, 5) as $star) <flux:icon.star variant="micro" @class(['text-zinc-800 dark:text-white' => $star <= floor($product['rating']), 'text-zinc-300 dark:text-zinc-600' => $star > floor($product['rating'])]) /> @endforeach </div> <flux:text>{{ $product['rating'] }} ({{ $product['reviews'] }})</flux:text> </div> <div class="flex items-baseline gap-2"> <flux:heading size="xl">{{ $product['price'] }}</flux:heading> @if ($product['was']) <flux:text class="line-through"><span class="sr-only">Was </span>{{ $product['was'] }}</flux:text> @endif </div> <flux:button variant="primary" icon="shopping-bag" class="mt-auto w-full">Add to cart</flux:button> </div> </div> @endforeach </div> <flux:pagination :paginator="$this->products" class="mt-12" /> </main> </div></div>