Open History to see the last commit
1<script setup lang="ts">
2import { ref } from 'vue'
3import { RouterLink } from 'vue-router'
4
5const isOpen = ref(false)
6</script>
7
8<template>
9 <header class="p-4 flex items-center bg-gray-800 text-white shadow-lg">
10 <button
11 @click="isOpen = true"
12 class="p-2 hover:bg-gray-700 rounded-lg transition-colors"
13 aria-label="Open menu"
14 >
15 <svg
16 class="w-6 h-6"
17 fill="none"
18 stroke="currentColor"
19 viewBox="0 0 24 24"
20 >
21 <path
22 stroke-linecap="round"
23 stroke-linejoin="round"
24 stroke-width="2"
25 d="M4 6h16M4 12h16M4 18h16"
26 />
27 </svg>
28 </button>
29 <h1 class="ml-4 text-xl font-semibold">
30 <RouterLink to="/">
31 <img
32 src="/tanstack-word-logo-white.svg"
33 alt="TanStack Logo"
34 class="h-10"
35 />
36 </RouterLink>
37 </h1>
38 </header>
39
40 <!-- Sidebar -->
41 <aside
42 :class="[
43 'fixed top-0 left-0 h-full w-80 bg-gray-900 text-white shadow-2xl z-50 transform transition-transform duration-300 ease-in-out flex flex-col',
44 isOpen ? 'translate-x-0' : '-translate-x-full',
45 ]"
46 >
47 <div class="flex items-center justify-between p-4 border-b border-gray-700">
48 <h2 class="text-xl font-bold">Navigation</h2>
49 <button
50 @click="isOpen = false"
51 class="p-2 hover:bg-gray-800 rounded-lg transition-colors"
52 aria-label="Close menu"
53 >
54 <svg
55 class="w-6 h-6"
56 fill="none"
57 stroke="currentColor"
58 viewBox="0 0 24 24"
59 >
60 <path
61 stroke-linecap="round"
62 stroke-linejoin="round"
63 stroke-width="2"
64 d="M6 18L18 6M6 6l12 12"
65 />
66 </svg>
67 </button>
68 </div>
69
70 <nav class="flex-1 p-4 overflow-y-auto">
71 <RouterLink
72 to="/"
73 @click="isOpen = false"
74 class="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"
75 active-class="bg-cyan-600 hover:bg-cyan-700"
76 >
77 <svg
78 class="w-5 h-5"
79 fill="none"
80 stroke="currentColor"
81 viewBox="0 0 24 24"
82 >
83 <path
84 stroke-linecap="round"
85 stroke-linejoin="round"
86 stroke-width="2"
87 d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
88 />
89 </svg>
90 <span class="font-medium">Home</span>
91 </RouterLink>
92
93 <hr class="border-gray-700 my-2" />
94
95 <RouterLink
96 to="/vue-ui"
97 @click="isOpen = false"
98 class="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"
99 active-class="bg-cyan-600 hover:bg-cyan-700"
100 >
101 <svg
102 class="w-5 h-5"
103 fill="none"
104 stroke="currentColor"
105 viewBox="0 0 24 24"
106 >
107 <path
108 stroke-linecap="round"
109 stroke-linejoin="round"
110 stroke-width="2"
111 d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
112 />
113 </svg>
114 <span class="font-medium">Vue UI Demo</span>
115 </RouterLink>
116
117 <RouterLink
118 to="/guitars"
119 @click="isOpen = false"
120 class="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"
121 active-class="bg-cyan-600 hover:bg-cyan-700"
122 >
123 <svg
124 class="w-5 h-5"
125 fill="none"
126 stroke="currentColor"
127 viewBox="0 0 24 24"
128 >
129 <path
130 stroke-linecap="round"
131 stroke-linejoin="round"
132 stroke-width="2"
133 d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"
134 />
135 </svg>
136 <span class="font-medium">Guitar Demo</span>
137 </RouterLink>
138 </nav>
139 </aside>
140
141 <!-- Overlay -->
142 <div
143 v-if="isOpen"
144 @click="isOpen = false"
145 class="fixed inset-0 bg-black/50 z-40"
146 />
147</template>