Markup: stable island targets for wishlist, account link and CSRF meta
- x-wishlist-button gets data-wishlist-product on its form root; the server-rendered aria-pressed stays for now. - Both header account links (desktop and mobile menu) share [data-account-link]. - The CSRF meta tag gets id="csrf-token". No visible change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6948c134e3
commit
4fc7880187
3 files changed
+10
-2
No files matched your search
@@ -55,8 +55,10 @@ class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 tra
|
||||
<x-ui.icon name="heart" :size="40" />
|
||||
</a>
|
||||
|
||||
{{-- Account — the account page, or login for guests --}}
|
||||
{{-- Account — the account page, or login for guests. [data-account-link]
|
||||
is the island target shared with the mobile menu's link. --}}
|
||||
<a
|
||||
data-account-link
|
||||
href="{{ auth()->check() ? route('account') : route('login') }}"
|
||||
class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
|
||||
aria-label="{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}"
|
||||
@@ -188,6 +190,7 @@ class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
data-account-link
|
||||
href="{{ auth()->check() ? route('account') : route('login') }}"
|
||||
class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
|
||||
>
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
`wishlist` Stimulus controller turns the submit into a fetch and flips
|
||||
aria-pressed, which the CSS (group-aria-pressed) uses to swap the icons.
|
||||
|
||||
[data-wishlist-product] is the island target: the heart state will come
|
||||
from the islands request. aria-pressed is still rendered server-side for
|
||||
now.
|
||||
|
||||
Usage: <x-wishlist-button :product-id="$product['id']" class="absolute top-4 right-4" />
|
||||
--}}
|
||||
@props(['productId'])
|
||||
@@ -16,6 +20,7 @@
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('wishlist.toggle', ['productId' => $productId]) }}"
|
||||
data-wishlist-product="{{ $productId }}"
|
||||
data-controller="wishlist"
|
||||
data-action="submit->wishlist#toggle"
|
||||
data-wishlist-add-label-value="{{ $addLabel }}"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta id="csrf-token" name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
{{-- Favicons --}}
|
||||
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
||||
|
||||
Reference in new issue
Block a user