Skip to content

Commit b0ec54c

Browse files
💄 Rework the platform switcher
1 parent 0c0d143 commit b0ec54c

File tree

2 files changed

+22
-98
lines changed

2 files changed

+22
-98
lines changed

‎resources/views/components/docs/platform-switcher.blade.php‎

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -4,90 +4,33 @@
44
$desktopHref = '/docs/desktop/1';
55
@endphp
66

7-
<div
8-
{{ $attributes }}
9-
class="mx-1 mb-3 rounded-xl bg-zinc-100/80 transition-all duration-300 ease-in-out dark:bg-mirage"
10-
:class="{
11-
'pb-4 pl-4 pr-5 pt-5' : showPlatformSwitcherHeader,
12-
'pb-2 pl-2 pr-3 pt-3' : !showPlatformSwitcherHeader
13-
}"
7+
<a
8+
href="{{ $isMobile ? $desktopHref : $mobileHref }}"
9+
class="group relative mx-0.5 mb-3 w-full rounded-xl bg-gradient-to-tl from-transparent to-violet-100 px-3.5 py-4 dark:from-slate-900/30 dark:to-indigo-900/35"
1410
>
1511
<div
16-
x-show="showPlatformSwitcherHeader"
17-
x-collapse
18-
class="space-y-1.5"
12+
class="flex items-center gap-3 transition group-hover:translate-y-3 group-hover:opacity-0"
1913
>
20-
<div class="space-y-1 pl-1">
21-
{{-- Title --}}
22-
<div class="text-sm">Choose your platform</div>
23-
{{-- Description --}}
24-
<div class="text-xs opacity-60">
25-
Switch between mobile and desktop documentation.
14+
@if ($isMobile)
15+
<x-icons.device-mobile-phone class="size-6 shrink-0" />
16+
@else
17+
<x-icons.pc class="size-6 shrink-0" />
18+
@endif
19+
<div class="text-left">
20+
<div class="text-xs opacity-50">You're reading the</div>
21+
<div class="text-sm leading-6 capitalize">
22+
{{ $isMobile ? 'Mobile' : 'Desktop' }} Documentation
2623
</div>
2724
</div>
28-
{{-- Separator --}}
29-
<div
30-
class="h-px w-full rounded-full bg-current opacity-5 dark:opacity-15"
31-
></div>
3225
</div>
3326

34-
{{-- Switcher --}}
35-
<div
36-
class="flex items-center gap-3 text-xs"
37-
:class="{ 'mt-2.5': showPlatformSwitcherHeader }"
38-
>
39-
{{-- Desktop --}}
40-
<a
41-
href="{{ $desktopHref }}"
42-
@class([
43-
'flex w-1/2 items-center justify-center gap-x-1.5 gap-y-1 rounded-xl transition duration-300 ease-in-out',
44-
'bg-white dark:bg-slate-700/30' => ! $isMobile,
45-
'hover:bg-zinc-200/50 dark:text-gray-400/80 dark:hover:bg-gray-900/80 dark:hover:text-white' => $isMobile,
46-
])
47-
:class="{ 'flex-col p-2.5': showPlatformSwitcherHeader, 'flex-row p-2': !showPlatformSwitcherHeader }"
48-
>
49-
<div
50-
@class([
51-
'grid h-9 w-10 place-items-center rounded-lg',
52-
'bg-blue-50 text-blue-500 dark:bg-haiti dark:text-blue-400' => ! $isMobile,
53-
])
54-
>
55-
<x-icons.pc class="size-6 shrink-0" />
56-
</div>
57-
<div>Desktop</div>
58-
</a>
59-
60-
{{-- Center icon --}}
61-
<svg
62-
xmlns="http://www.w3.org/2000/svg"
63-
class="size-6 dark:text-gray-400/80"
64-
viewBox="0 0 256 256"
65-
>
66-
<path
67-
fill="currentColor"
68-
d="M144 128a16 16 0 1 1-16-16a16 16 0 0 1 16 16m-84-16a16 16 0 1 0 16 16a16 16 0 0 0-16-16m136 0a16 16 0 1 0 16 16a16 16 0 0 0-16-16"
69-
/>
70-
</svg>
71-
72-
{{-- Mobile --}}
73-
<a
74-
href="{{ $mobileHref }}"
75-
@class([
76-
'flex w-1/2 items-center justify-center gap-x-1.5 gap-y-1 rounded-xl transition duration-300 ease-in-out',
77-
'bg-white dark:bg-slate-700/30' => $isMobile,
78-
'hover:bg-zinc-200/50 dark:text-gray-400/80 dark:hover:bg-gray-900/80 dark:hover:text-white' => ! $isMobile,
79-
])
80-
:class="{ 'flex-col p-2.5': showPlatformSwitcherHeader, 'flex-row p-2': !showPlatformSwitcherHeader }"
27+
<div class="absolute top-1/2 right-1/2 translate-x-1/2 -translate-y-1/2">
28+
<div
29+
class="flex -translate-y-3 items-center justify-center gap-2 opacity-0 transition group-hover:translate-y-0 group-hover:opacity-100"
8130
>
82-
<div
83-
@class([
84-
'grid h-9 w-10 place-items-center rounded-lg',
85-
'bg-blue-50 text-blue-500 dark:bg-haiti dark:text-blue-400' => $isMobile,
86-
])
87-
>
88-
<x-icons.device-mobile-phone class="size-5 shrink-0" />
89-
</div>
90-
<div>Mobile</div>
91-
</a>
31+
{{ $isMobile ? 'Mobile' : 'Desktop' }}
32+
<x-icons.right-arrow class="size-3" />
33+
{{ $isMobile ? 'Desktop' : 'Mobile' }}
34+
</div>
9235
</div>
93-
</div>
36+
</a>

‎resources/views/components/docs/sidebar-left-navigation.blade.php‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
1-
@php
2-
$isMobile = request()->is('docs/mobile/*');
3-
@endphp
4-
51
<aside
62
class="sticky top-20 hidden max-h-[calc(100dvh-7rem)] w-[18rem] shrink-0 overflow-x-hidden overflow-y-auto pt-4 pr-3 lg:block"
73
>
84
<div class="relative flex flex-1 flex-col pb-5">
9-
{{-- <x-docs.platform-switcher /> --}}
10-
<div
11-
class="mx-0.5 mb-3 flex w-full items-center gap-3 rounded-xl bg-gradient-to-tl from-transparent to-violet-100 px-3.5 py-4 dark:from-slate-900/30 dark:to-indigo-900/35"
12-
>
13-
@if ($isMobile)
14-
<x-icons.device-mobile-phone class="size-6 shrink-0" />
15-
@else
16-
<x-icons.pc class="size-6 shrink-0" />
17-
@endif
18-
<div class="text-left">
19-
<div class="text-xs opacity-50">You're reading the</div>
20-
<div class="text-sm leading-6 capitalize">
21-
{{ $isMobile ? 'Mobile' : 'Desktop' }} Documentation
22-
</div>
23-
</div>
24-
</div>
5+
<x-docs.platform-switcher />
256

267
<nav class="docs-navigation">{!! $slot !!}</nav>
278
</div>

0 commit comments

Comments
 (0)