Adding sidebar

This commit is contained in:
Ronan Berder
2025-04-18 21:03:35 +08:00
parent 29101f5ca4
commit ec2f68d3b0
26 changed files with 1239 additions and 208 deletions
+742 -7
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -39,6 +39,7 @@
--scrollbar-thumb: rgba(0, 0, 0, 0.3);
--scrollbar-width: 6px;
--scrollbar-radius: 6px;
--sidebar-width: 16rem;
--chevron-down-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="oklch(0.556 0 0 / 0.5)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>'); /* --muted-foreground + 50% opacity */
--check-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="oklch(0.556 0 0)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>'); /* --muted-foreground */
}
@@ -719,7 +720,7 @@
&[data-side='top'],
&[data-side='bottom'] {
&[data-align='start'] {
@apply before:bg-red-500 before:left-0;
@apply before:left-0;
}
&[data-align='end'] {
@apply before:right-0;
-1
View File
@@ -59,7 +59,6 @@
},
selectOptionByValue(value) {
console.log(value);
const option = this.options.find(opt => opt.getAttribute('data-value') === value);
this.selectOption(option);
},
@@ -1,4 +1,4 @@
<section id="accordion" class="w-full rounded-lg border">
<section id="accordion" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Accordion</h2>
</header>
@@ -19,30 +19,30 @@
"
>
<details class="group border-b last:border-b-0">
<summary class="w-full">
<h2 class="focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50">
<summary class="w-full focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all outline-none rounded-md">
<h2 class="flex flex-1 items-start justify-between gap-4 py-4 text-left text-sm font-medium hover:underline ">
Is it accessible?
{% lucide "chevron-down", { "class": "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 group-open:rotate-180" } %}
</h2>
</summary>
<section>
<section class="pb-4">
<p class="text-sm">Yes. It adheres to the WAI-ARIA design pattern.</p>
</section>
</details>
<details class="group border-b last:border-b-0">
<summary class="w-full">
<h2 class="focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50">
<summary class="w-full focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all outline-none rounded-md">
<h2 class="flex flex-1 items-start justify-between gap-4 py-4 text-left text-sm font-medium hover:underline ">
Is it styled?
{% lucide "chevron-down", { "class": "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 group-open:rotate-180" } %}
</h2>
</summary>
<section>
<section class="pb-4">
<p class="text-sm">Yes. It comes with default styles that matches the other components' aesthetic.</p>
</section>
</details>
<details class="group border-b last:border-b-0">
<summary class="w-full">
<h2 class="focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50">
<summary class="w-full focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all outline-none rounded-md">
<h2 class="flex flex-1 items-start justify-between gap-4 py-4 text-left text-sm font-medium hover:underline ">
Is it animated?
{% lucide "chevron-down", { "class": "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 group-open:rotate-180" } %}
</h2>
@@ -52,21 +52,34 @@
</section>
</details>
</section>
<section>
<section
x-init
@click="
const clickedSummary = $event.target.closest('summary');
if (!clickedSummary) return;
const clickedDetails = clickedSummary.closest('details');
if (!clickedDetails) return;
$el.querySelectorAll('details').forEach(detailsEl => {
if (detailsEl !== clickedDetails) {
detailsEl.removeAttribute('open');
}
});
"
>
<details class="group border-b last:border-b-0">
<summary class="w-full">
<h2 class="focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50">
<summary class="w-full focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all outline-none rounded-md">
<h2 class="flex flex-1 items-start justify-between gap-4 py-4 text-left text-sm font-medium hover:underline ">
What are the key considerations when implementing a comprehensive enterprise-level authentication system?
{% lucide "chevron-down", { "class": "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 group-open:rotate-180" } %}
</h2>
</summary>
<section>
<section class="pb-4">
<p class="text-sm">Implementing a robust enterprise authentication system requires careful consideration of multiple factors. This includes secure password hashing and storage, multi-factor authentication (MFA) implementation, session management, OAuth2 and SSO integration, regular security audits, rate limiting to prevent brute force attacks, and maintaining detailed audit logs. Additionally, you'll need to consider scalability, performance impact, and compliance with relevant data protection regulations such as GDPR or HIPAA.</p>
</section>
</details>
<details class="group">
<summary class="w-full">
<h2 class="focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50">
<summary class="w-full focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all outline-none rounded-md">
<h2 class="flex flex-1 items-start justify-between gap-4 py-4 text-left text-sm font-medium hover:underline ">
How does modern distributed system architecture handle eventual consistency and data synchronization across multiple regions?
{% lucide "chevron-down", { "class": "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 group-open:rotate-180" } %}
</h2>
@@ -1,4 +1,4 @@
<section id="alert-dialog" class="w-full rounded-lg border">
<section id="alert-dialog" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Alert Dialog</h2>
</header>
@@ -1,4 +1,4 @@
<section id="alert" class="w-full rounded-lg border">
<section id="alert" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Alert</h2>
</header>
@@ -58,6 +58,21 @@
</ul>
</section>
</div>
{# <div class="alert">
{% lucide "circle-check" %}
<h2>Something went wrong!</h2>
<section>Your session has expired. Please log in again.</section>
<button type="button" class="btn-sm-outline">
Undo
</button>
</div> #}
<div class="alert border-amber-50 bg-amber-50 text-amber-900 dark:border-amber-950 dark:bg-amber-950 dark:text-amber-100">
{% lucide "circle-check" %}
<h2>Plot Twist: This Alert is Actually Amber!</h2>
<section>This one has custom colors for light and dark mode.</section>
</div>
</div>
</div>
</section>
@@ -1,4 +1,4 @@
<section id="badge" class="w-full rounded-lg border">
<section id="badge" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Badge</h2>
</header>
@@ -1,4 +1,4 @@
<section id="breadcrumb" class="w-full rounded-lg border">
<section id="breadcrumb" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Breadcrumb</h2>
</header>
@@ -1,4 +1,4 @@
<section id="button" class="w-full rounded-lg border">
<section id="button" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Button</h2>
</header>
@@ -1,4 +1,4 @@
<section id="checkbox" class="w-full rounded-lg border">
<section id="checkbox" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Checkbox</h2>
</header>
@@ -9,9 +9,9 @@
Accept terms and conditions
</label>
<div class="flex items-start gap-3">
<input type="checkbox" id="checkbox-demo-label-and-description" class="input">
<input type="checkbox" id="demo-checkbox-label-and-description" class="input">
<div class="grid gap-2">
<label for="checkbox-demo-label-and-description" class="label">Accept terms and conditions</label>
<label for="demo-checkbox-label-and-description" class="label">Accept terms and conditions</label>
<p class="text-muted-foreground text-sm">By clicking this checkbox, you agree to the terms and conditions.</p>
</div>
</div>
@@ -20,7 +20,7 @@
Enable notifications
</label>
<label class="flex items-start gap-3 border p-3 hover:bg-accent/50 rounded-lg has-[input[type='checkbox']:checked]:border-blue-600 has-[input[type='checkbox']:checked]:bg-blue-50 dark:has-[input[type='checkbox']:checked]:border-blue-900 dark:has-[input[type='checkbox']:checked]:bg-blue-950">
<input type="checkbox" id="checkbox-demo-label-and-description" class="input checked:bg-blue-600 checked:border-blue-600 dark:checked:bg-blue-700 dark:checked:border-blue-700 checked:after:bg-white" checked>
<input type="checkbox" class="input checked:bg-blue-600 checked:border-blue-600 dark:checked:bg-blue-700 dark:checked:border-blue-700 checked:after:bg-white" checked>
<div class="grid gap-2">
<h2 class="text-sm leading-none font-medium">Accept terms and conditions</h2>
<p class="text-muted-foreground text-sm">By clicking this checkbox, you agree to the terms and conditions.</p>
@@ -1,4 +1,4 @@
<section id="dialog" class="w-full rounded-lg border">
<section id="dialog" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Dialog</h2>
</header>
@@ -20,12 +20,12 @@
) %}
<form class="form grid gap-4">
<div class="grid gap-3">
<label>Name</label>
<input type="text" value="Pedro Duarte"/>
<label for="demo-dialog-edit-profile-name">Name</label>
<input type="text" value="Pedro Duarte" id="demo-dialog-edit-profile-name" />
</div>
<div class="grid gap-3">
<label>Username</label>
<input type="email" value="@peduarte"/>
<label for="demo-dialog-edit-profile-username">Username</label>
<input type="text" value="@peduarte" id="demo-dialog-edit-profile-username" />
</div>
</form>
{% endcall %}
@@ -58,11 +58,11 @@
</div>
{% endcall %}
<button x-init @click="
console.log('clicked');
$dispatch('dialog:control', { targetId: 'dialog-example', action: 'open' })
"
type="button" class="btn-outline"
<button
x-init
@click="$dispatch('dialog:control', { targetId: 'dialog-example', action: 'open' })"
type="button"
class="btn-outline"
>
Trigger dialog:control
</button>
@@ -1,4 +1,4 @@
<section id="dropdown" class="w-full rounded-lg border">
<section id="dropdown" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Dropdown</h2>
</header>
+106
View File
@@ -0,0 +1,106 @@
<section id="form" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Form</h2>
</header>
<div class="p-4">
<form class="form grid w-full max-w-sm gap-6">
<div class="grid gap-2">
<label for="demo-form-text">Username</label>
<input type="text" id="demo-form-text" placeholder="hunvreus">
<p class="text-muted-foreground text-sm">This is your public display name.</p>
</div>
<div class="grid gap-2">
<label for="demo-form-select">Email</label>
<select id="demo-form-select">
<option value="bob@example.com">m@example.com</option>
<option value="alice@example.com">m@google.com</option>
<option value="john@example.com">m@support.com</option>
</select>
<p class="text-muted-foreground text-sm">You can manage email addresses in your email settings.</p>
</div>
<div class="grid gap-2">
<label for="demo-form-text">Bio</label>
<textarea id="demo-form-textarea" placeholder="I like to..." rows="3"></textarea>
<p class="text-muted-foreground text-sm">You can @mention other users and organizations.</p>
</div>
<div class="flex flex-col gap-3">
<label for="demo-form-radio">Notify me about...</label>
<fieldset id="demo-form-radio" class="grid gap-3">
<label class="font-normal"><input type="radio" name="demo-form-radio" value="1">All new messages</label>
<label class="font-normal"><input type="radio" name="demo-form-radio" value="2">Direct messages and mentions</label>
<label class="font-normal"><input type="radio" name="demo-form-radio" value="3" >Nothing</label>
</fieldset>
</div>
<div class="flex flex-row items-start gap-3 rounded-md border p-4 shadow-xs">
<input type="checkbox" id="demo-form-checkbox">
<div class="flex flex-col gap-1">
<label for="demo-form-checkbox" class="leading-snug">Use different settings for my mobile devices</label>
<p class="text-muted-foreground text-sm leading-snug">You can manage your mobile notifications in the mobile settings page.</p>
</div>
</div>
<div class="flex flex-col gap-4">
<header>
<label for="demo-form-checkboxes" class="text-base leading-normal">Sidebar</label>
<p class="text-muted-foreground text-sm">Select the items you want to display in the sidebar.</p>
</header>
<fieldset id="demo-form-checkboxes" class="flex flex-col gap-2">
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="1" checked>
Recents
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="2" checked>
Home
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="3">
Applications
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="4">
Desktop
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="5">
Download
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="6">
Documents
</label>
</fieldset>
</div>
<div class="grid gap-2">
<label for="demo-form-date">Date of birth</label>
<input type="date" id="demo-form-date">
<p class="text-muted-foreground text-sm">Your date of birth is used to calculate your age.</p>
</div>
<section class="grid gap-4">
<h3 class="text-lg font-medium">Email Notifications</h3>
<div class="gap-2 flex flex-row items-start justify-between rounded-lg border p-4 shadow-xs">
<div class="flex flex-col gap-0.5">
<label for="demo-form-switch" class="leading-normal">Marketing emails</label>
<p class="text-muted-foreground text-sm">Receive emails about new products, features, and more.</p>
</div>
<input type="checkbox" id="demo-form-switch" role="switch">
</div>
<div class="gap-2 flex flex-row items-start justify-between rounded-lg border p-4 shadow-xs">
<div class="flex flex-col gap-0.5 opacity-60">
<label for="demo-form-switch-disabled" class="leading-normal">Marketing emails</label>
<p class="text-muted-foreground text-sm">Receive emails about new products, features, and more.</p>
</div>
<input type="checkbox" id="demo-form-switch-disabled" role="switch" disabled>
</div>
</section>
<button type="submit" class="btn">Submit</button>
</form>
</div>
</section>
@@ -1,4 +1,4 @@
<section id="input" class="w-full rounded-lg border">
<section id="input" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Input</h2>
</header>
@@ -1,4 +1,4 @@
<section id="label" class="w-full rounded-lg border">
<section id="label" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Label</h2>
</header>
@@ -1,4 +1,4 @@
<section id="pagination" class="w-full rounded-lg border">
<section id="pagination" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Pagination</h2>
</header>
@@ -1,4 +1,4 @@
<section id="radio-group" class="w-full rounded-lg border">
<section id="radio-group" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Radio Group</h2>
</header>
@@ -1,4 +1,4 @@
<section id="select" class="w-full rounded-lg border">
<section id="select" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Select</h2>
</header>
@@ -1,4 +1,4 @@
<section id="slider" class="w-full rounded-lg border">
<section id="slider" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Slider</h2>
</header>
@@ -1,4 +1,4 @@
<section id="switch" class="w-full rounded-lg border">
<section id="switch" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Switch</h2>
</header>
@@ -1,4 +1,4 @@
<section id="table" class="w-full rounded-lg border">
<section id="table" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Table</h2>
</header>
@@ -1,4 +1,4 @@
<section id="textarea" class="w-full rounded-lg border">
<section id="textarea" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Textarea</h2>
</header>
@@ -1,4 +1,4 @@
<section id="tooltip" class="w-full rounded-lg border">
<section id="tooltip" class="w-full rounded-lg border scroll-mt-16">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Tooltip</h2>
</header>
-106
View File
@@ -1,106 +0,0 @@
<section id="form" class="w-full rounded-lg border">
<header class="border-b px-4 py-3">
<h2 class="text-sm font-medium">Form</h2>
</header>
<div class="p-4">
<form class="form grid w-full max-w-sm gap-6">
<div class="grid gap-2">
<label for="demo-form-text">Username</label>
<input type="text" id="demo-form-text" placeholder="hunvreus">
<p class="text-muted-foreground text-sm">This is your public display name.</p>
</div>
<div class="grid gap-2">
<label for="demo-form-select">Email</label>
<select id="demo-form-select">
<option value="bob@example.com">m@example.com</option>
<option value="alice@example.com">m@google.com</option>
<option value="john@example.com">m@support.com</option>
</select>
<p class="text-muted-foreground text-sm">You can manage email addresses in your email settings.</p>
</div>
<div class="grid gap-2">
<label for="demo-form-text">Bio</label>
<textarea id="demo-form-textarea" placeholder="I like to..." rows="3"></textarea>
<p class="text-muted-foreground text-sm">You can @mention other users and organizations.</p>
</div>
<div class="flex flex-col gap-3">
<label for="demo-form-radio">Notify me about...</label>
<fieldset id="demo-form-radio" class="grid gap-3">
<label class="font-normal"><input type="radio" name="demo-form-radio" value="1">All new messages</label>
<label class="font-normal"><input type="radio" name="demo-form-radio" value="2">Direct messages and mentions</label>
<label class="font-normal"><input type="radio" name="demo-form-radio" value="3" >Nothing</label>
</fieldset>
</div>
<div class="flex flex-row items-start gap-3 rounded-md border p-4 shadow-xs">
<input type="checkbox" id="demo-form-checkbox">
<div class="flex flex-col gap-1">
<label for="demo-form-checkbox" class="leading-snug">Use different settings for my mobile devices</label>
<p class="text-muted-foreground text-sm leading-snug">You can manage your mobile notifications in the mobile settings page.</p>
</div>
</div>
<div class="flex flex-col gap-4">
<header>
<label for="demo-form-checkboxes" class="text-base leading-normal">Sidebar</label>
<p class="text-muted-foreground text-sm">Select the items you want to display in the sidebar.</p>
</header>
<fieldset id="demo-form-checkboxes" class="flex flex-col gap-2">
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="1" checked>
Recents
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="2" checked>
Home
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="3">
Applications
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="4">
Desktop
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="5">
Download
</label>
<label class="font-normal leading-tight">
<input type="checkbox" name="demo-form-checkboxes" value="6">
Documents
</label>
</fieldset>
</div>
<div class="grid gap-2">
<label for="demo-form-date">Date of birth</label>
<input type="date" id="demo-form-date">
<p class="text-muted-foreground text-sm">Your date of birth is used to calculate your age.</p>
</div>
<section class="grid gap-4">
<h3 class="text-lg font-medium">Email Notifications</h3>
<div class="gap-2 flex flex-row items-start justify-between rounded-lg border p-4 shadow-xs">
<div class="flex flex-col gap-0.5">
<label for="demo-form-switch" class="leading-normal">Marketing emails</label>
<p class="text-muted-foreground text-sm">Receive emails about new products, features, and more.</p>
</div>
<input type="checkbox" id="demo-form-switch" role="switch">
</div>
<div class="gap-2 flex flex-row items-start justify-between rounded-lg border p-4 shadow-xs">
<div class="flex flex-col gap-0.5 opacity-60">
<label for="demo-form-switch" class="leading-normal">Marketing emails</label>
<p class="text-muted-foreground text-sm">Receive emails about new products, features, and more.</p>
</div>
<input type="checkbox" id="demo-form-switch" role="switch" disabled>
</div>
</section>
<button type="submit" class="btn">Submit</button>
</form>
</div>
</section>
+240
View File
@@ -0,0 +1,240 @@
<header class="flex flex-col gap-2 p-2">
{% set trigger %}
<div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
{% lucide "gallery-vertical-end", { "class": "size-4" } %}
</div>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-medium">Acme Inc</span>
<span class="truncate text-xs">Enterprise</span>
</div>
{% lucide "chevrons-up-down", { "class": "ml-auto" } %}
{% endset %}
{% call dropdown(
id="dropdown-checkboxes",
trigger=trigger,
trigger_attrs={"class": "btn-ghost p-2 h-12 w-full justify-start"},
menu_attrs={"data-side": "right"}
) %}
Something
{% endcall %}
<div class="flex flex-col gap-2 px-2 text-sm">
<form class="form relative">
<label for="search" class="sr-only">Search</label>
<input type="text" placeholder="Search the docs..." class="h-8 w-full shadow-none pl-8">
{% lucide "search", { "class": "pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 opacity-50 select-none" } %}
</form>
</div>
</header>
<section class="flex flex-1 flex-col gap-2 overflow-y-auto">
<nav aria-label="Pages navigation" class="flex flex-col p-2">
<h2 class="text-sidebar-foreground/70 flex h-8 items-center px-2 text-xs font-medium">Pages</h2>
<ul class="flex flex-col gap-1">
<li>
<a
href="#alert-dialog"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>
{% lucide "house" %}
Homepage
</a>
</li>
<li>
<a
href="#alert-dialog"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>
{% lucide "book-open" %}
Docs
</a>
</li>
<li>
<a
href="#alert-dialog"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>
{% lucide "github" %}
GitHub
{% lucide "arrow-up-right", { "class": "text-muted-foreground size-3.5 ml-auto" } %}
</a>
</li>
</ul>
</nav>
<nav aria-label="Components navigation" class="flex flex-col p-2">
<h2 class="text-sidebar-foreground/70 flex h-8 items-center px-2 text-xs font-medium">Components</h2>
<ul class="flex flex-col gap-1">
<li>
<a
href="#accordion"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Accordion</a>
</li>
<li>
<a
href="#alert"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Alert</a>
</li>
<li>
<a
href="#alert-dialog"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Alert Dialog</a>
</li>
<li>
<a
href="#badge"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Badge</a>
</li>
<li>
<a
href="#breadcrumb"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Breadcrumb</a>
</li>
<li>
<a
href="#button"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Button</a>
</li>
<li>
<a
href="#checkbox"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Checkbox</a>
</li>
<li>
<a
href="#dialog"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Dialog</a>
</li>
<li>
<a
href="#dropdown"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Dropdown</a>
</li>
<li>
<a
href="#form"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Form</a>
</li>
<li>
<a
href="#input"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Input</a>
</li>
<li>
<a
href="#label"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Label</a>
</li>
<li>
<a
href="#pagination"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Pagination</a>
</li>
<li>
<a
href="#radio-group"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Radio Group</a>
</li>
<li>
<a
href="#select"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Select</a>
</li>
<li>
<a
href="#slider"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Slider</a>
</li>
<li>
<a
href="#switch"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Switch</a>
</li>
<li>
<a
href="#table"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Table</a>
</li>
<li>
<a
href="#textarea"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Textarea</a>
</li>
<li>
<a
href="#tooltip"
class="h-8 flex items-center gap-2 rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0"
>Tooltip</a>
</li>
</ul>
</nav>
</section>
<footer class="flex flex-col gap-2 p-2">
{% set profile_menu %}
<div class="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<img src="https://avatar.vercel.sh/ronan_berder" class="size-8 shrink-0 rounded-full" alt="Ronan Berder"/>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-semibold">hunvreus</span>
<span class="text-muted-foreground truncate text-xs">hunvreus@example.com</span>
</div>
</div>
<hr role="separator">
<button type="button" role="menuitem">
{% lucide "star" %}
Upgrade to Pro
</button>
<hr role="separator">
<button type="button" role="menuitem">
{% lucide "user" %}
Account
</button>
<button type="button" role="menuitem">
{% lucide "credit-card" %}
Billing
</button>
<button type="button" role="menuitem">
{% lucide "bell" %}
Notifications
</button>
<hr role="separator">
<button type="button" role="menuitem">
{% lucide "log-out" %}
Signout
</button>
{% endset %}
{% set trigger %}
<img src="https://avatar.vercel.sh/ronan_berder" class="size-8 shrink-0 rounded-full" alt="Ronan Berder"/>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-semibold">hunvreus</span>
<span class="text-muted-foreground truncate text-xs">hunvreus@example.com</span>
</div>
{% lucide "chevrons-up-down", { "class": "text-muted-foreground ml-auto" } %}
{% endset %}
{% call dropdown(
id="dropdown-checkboxes",
trigger=trigger,
trigger_attrs={"class": "btn-ghost h-12 justify-start p-2 w-full"},
menu_attrs={"class": "min-w-56", "data-side": "right", "data-align": "end"}
) %}
{{ profile_menu | safe }}
{% endcall %}
</footer>
+76 -48
View File
@@ -50,55 +50,83 @@
{% from "./_components/dialog.njk" import dialog %}
{% from "./_components/dropdown.njk" import dropdown %}
{% from "./_components/select.njk" import select %}
<header class="bg-background sticky inset-x-0 top-0 isolate z-10 flex shrink-0 items-center gap-2 border-b">
<div class="flex h-14 w-full items-center gap-2 px-4">
<span class="mr-auto">Basecoat</span>
<select class="select h-8">
<option value="light">Default</option>
<option value="light">Other</option>
</select>
<button
x-data
@click="$store.theme.toggle()"
aria-label="Toggle theme"
data-tooltip="Toggle theme"
data-side="bottom"
data-align="end"
type="button"
class="btn-icon-outline size-8"
aria-label="Toggle theme"
>
<span x-show="$store.theme.isDark">
{% lucide "sun" %}
</span>
<span x-show="!$store.theme.isDark">
{% lucide "moon" %}
</span>
</button>
</div>
</header>
<div class="@container grid flex-1 gap-4 p-4">
{% include "./_includes/accordion.njk" %}
{% include "./_includes/alert.njk" %}
{% include "./_includes/alert-dialog.njk" %}
{% include "./_includes/badge.njk" %}
{% include "./_includes/breadcrumb.njk" %}
{% include "./_includes/button.njk" %}
{% include "./_includes/checkbox.njk" %}
{% include "./_includes/dialog.njk" %}
{% include "./_includes/dropdown.njk" %}
{% include "./_includes/form.njk" %}
{% include "./_includes/input.njk" %}
{% include "./_includes/label.njk" %}
{% include "./_includes/pagination.njk" %}
{% include "./_includes/radio-group.njk" %}
{% include "./_includes/select.njk" %}
{% include "./_includes/slider.njk" %}
{% include "./_includes/switch.njk" %}
{% include "./_includes/table.njk" %}
{% include "./_includes/textarea.njk" %}
{% include "./_includes/tooltip.njk" %}
<div
class="fixed inset-y-0 left-0 z-50 h-svh border-r bg-sidebar text-sidebar-foreground flex flex-col w-[var(--sidebar-width)] transition-transform ease-in-out peer aria-[hidden=true]:-translate-x-full"
aria-hidden="false"
:aria-hidden="open ? 'false' : 'true'"
@dialog:sidebar.window="toggle()"
x-data="{
open: true,
toggle() { this.open = !this.open }
}"
>
{% include "./_includes/sidebar.njk" %}
</div>
<main class="relative ml-(--sidebar-width) peer-aria-hidden:ml-0 transition-[margin-left] ease-in-out">
<header class="bg-background sticky inset-x-0 top-0 isolate z-10 flex shrink-0 items-center gap-2 border-b">
<div class="flex h-14 w-full items-center gap-2 px-4">
<button
type="button"
aria-label="Hide sidebar"
data-tooltip="Hide sidebar"
:data-tooltip="sidebarOpen ? 'Hide sidebar' : 'Show sidebar'"
data-side="bottom"
data-align="start"
class="btn-icon-ghost size-8 mr-auto"
x-init
x-data="{ sidebarOpen: true }"
@click="
sidebarOpen = !sidebarOpen;
$dispatch('dialog:sidebar', { action: 'toggle' });
"
>
<span x-show="sidebarOpen">{% lucide "panel-left-close" %}</span>
<span x-show="!sidebarOpen">{% lucide "panel-left-open" %}</span>
</button>
<select class="select h-8">
<option value="light">Default</option>
<option value="light">Other</option>
</select>
<button
type="button"
aria-label="Toggle theme"
data-tooltip="Toggle theme"
data-side="bottom"
data-align="end"
class="btn-icon-outline size-8"
x-init
@click="$store.theme.toggle()"
>
<span x-show="$store.theme.isDark">{% lucide "sun" %}</span>
<span x-show="!$store.theme.isDark">{% lucide "moon" %}</span>
</button>
</div>
</header>
<div class="grid gap-4 p-4">
{% include "./_includes/components/accordion.njk" %}
{% include "./_includes/components/alert.njk" %}
{% include "./_includes/components/alert-dialog.njk" %}
{% include "./_includes/components/badge.njk" %}
{% include "./_includes/components/breadcrumb.njk" %}
{% include "./_includes/components/button.njk" %}
{% include "./_includes/components/checkbox.njk" %}
{% include "./_includes/components/dialog.njk" %}
{% include "./_includes/components/dropdown.njk" %}
{% include "./_includes/components/form.njk" %}
{% include "./_includes/components/input.njk" %}
{% include "./_includes/components/label.njk" %}
{% include "./_includes/components/pagination.njk" %}
{% include "./_includes/components/radio-group.njk" %}
{% include "./_includes/components/select.njk" %}
{# {% include "./_includes/components/slider.njk" %} #}
{% include "./_includes/components/switch.njk" %}
{% include "./_includes/components/table.njk" %}
{% include "./_includes/components/textarea.njk" %}
{% include "./_includes/components/tooltip.njk" %}
</div>
</main>
</body>
</html>