Skip to content

Commit 21f031c

Browse files
✨ Add alignment option to device dropdowns and update class binding
1 parent c143cef commit 21f031c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

resources/views/components/navbar/device-dropdown.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$base = $id ?? \Illuminate\Support\Str::slug($label) . '-' . \Illuminate\Support\Str::random(6);
1111
$buttonId = $base . '-btn';
1212
$menuId = $base . '-menu';
13+
$align = $align ?? 'left'; // 'left', 'center'
1314
@endphp
1415

1516
<div
@@ -126,7 +127,7 @@ class="transition duration-200 will-change-transform"
126127
id="{{ $menuId }}"
127128
role="menu"
128129
aria-labelledby="{{ $buttonId }}"
129-
class="dark:bg-mirage absolute top-full left-0 mt-2 w-max max-w-[calc(100vw-1rem)] min-w-[16rem] origin-top overflow-y-auto overscroll-contain rounded-xl bg-white shadow-xl ring-1 shadow-black/5 ring-zinc-200/80 sm:right-auto sm:left-0 dark:text-white dark:ring-zinc-700/70"
130+
class="{{ $align === 'left' ? 'left-0' : 'left-1/2 -translate-x-1/2 sm:left-0 sm:translate-x-0' }} absolute top-full mt-2 w-max max-w-[calc(100vw-1rem)] min-w-[16rem] origin-top overflow-y-auto overscroll-contain rounded-xl bg-white shadow-xl ring-1 shadow-black/5 ring-zinc-200/80 sm:right-auto dark:bg-mirage dark:text-white dark:ring-zinc-700/70"
130131
@mouseenter="pointerFine && (closeTimeout && clearTimeout(closeTimeout))"
131132
@keydown.tab="closeMenu()"
132133
@keydown.arrow-down.prevent="(() => {

resources/views/components/navbar/device-dropdowns.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
icon="dollar-circle"
1919
icon-class="size-5.5"
2020
/>
21+
{{-- 👇 Hidden temporarily --}}
2122
{{--
22-
<x-navbar.device-dropdown-item
23+
<x-navbar.device-dropdown-item
2324
href="https://github.com/nativephp/mobile"
2425
title="GitHub"
2526
subtitle="Visit our GitHub repository"
2627
icon="github"
27-
/>
28+
/>
2829
--}}
2930
</x-navbar.device-dropdown>
3031

@@ -33,6 +34,7 @@
3334
label="Desktop"
3435
icon="pc"
3536
id="desktop-dropdown"
37+
align="center"
3638
>
3739
<x-navbar.device-dropdown-item
3840
href="/docs/desktop/1/getting-started/introduction"

0 commit comments

Comments
 (0)