Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
saadeghi committed Apr 11, 2024
1 parent adb63bd commit f4269b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/docs/src/components/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<div class="h-4" />

<ul class="menu px-4 py-0">
{#each pages as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items, collapsible, target }}
{#each pages as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items, collapsible, target, highlight }}
<SidebarMenuItem
{closeDrawer}
{name}
Expand All @@ -75,6 +75,7 @@
{deprecated}
{items}
{collapsible}
{highlight}
{target} />
{/each}
</ul>
17 changes: 12 additions & 5 deletions src/docs/src/components/SidebarMenuItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
deprecated = null,
items = null,
collapsible = null,
highlight = null,
target = null
const sanitize = (name) => {
Expand Down Expand Up @@ -56,7 +57,7 @@
{$t(name)}
</summary>
<ul>
{#each items as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items }}
{#each items as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items, highlight }}
<SidebarMenuItem
{closeDrawer}
{name}
Expand All @@ -66,6 +67,7 @@
{badgeclass}
{highlightAnotherItem}
{deprecated}
{highlight}
{items} />
{/each}
</ul>
Expand All @@ -81,7 +83,7 @@
{/if}
{#if items}
<ul>
{#each items as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items }}
{#each items as { name, href, icon, badge, badgeclass, highlightAnotherItem, deprecated, items, highlight }}
<SidebarMenuItem
{closeDrawer}
{name}
Expand All @@ -91,6 +93,7 @@
{badgeclass}
{highlightAnotherItem}
{deprecated}
{highlight}
{items} />
{/each}
</ul>
Expand All @@ -105,17 +108,21 @@
on:click={closeDrawer}
class={`group ${$page.url.pathname == href ? "active" : ""} ${
$page.url.pathname == highlightAnotherItem ? "active" : ""
} ${$page.url.pathname.startsWith(href) ? "active" : ""}`}>
} ${$page.url.pathname.startsWith(href) ? "active" : ""} ${
highlight
? "from-primary to-primary/0 hover:to-primary/10 from-[-200%] to-60% [background-image:linear-gradient(-35deg,var(--tw-gradient-stops))]"
: ""
}`}>
{#if icon}
<span>
<span class={highlight ? " group-hover:text-primary transition-colors" : ""}>
{@html icon}
</span>
{/if}
<span class={deprecated ? "line-through" : undefined}>
{@html $t(name)}
</span>
{#if badge}
<span class={`badge badge-sm font-mono ${badgeclass && badgeclass}`}>
<span class={`badge badge-sm font-mono text-opacity-70 ${badgeclass && badgeclass}`}>
{$t(badge)}
</span>
{/if}
Expand Down
15 changes: 2 additions & 13 deletions src/docs/src/lib/data/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,21 @@ export const pages = [
name: "Config",
tags: "setup config styled themes base logs utils rtl",
href: "/docs/config/",
badge: "updated",
},
{
name: "Colors",
tags: "colors",
href: "/docs/colors/",
badge: "updated",
},
{
name: "Themes",
tags: "themes disable custom color generator",
href: "/docs/themes/",
badge: "updated",
},
{
name: "Utilities",
tags: "Utilities utility class",
href: "/docs/utilities/",
badge: "new",
},
{
name: "Layout & Typography",
Expand All @@ -66,13 +62,11 @@ export const pages = [
name: "Button",
tags: "button btn",
href: "/components/button/",
badge: "updated",
},
{
name: "Dropdown",
tags: "dropdown popover menu listbox",
href: "/components/dropdown/",
badge: "updated",
},
{
name: "Modal",
Expand All @@ -88,7 +82,6 @@ export const pages = [
name: "Theme Controller",
tags: "theme controller change dark mode",
href: "/components/theme-controller/",
badge: "new",
},
],
},
Expand Down Expand Up @@ -140,7 +133,6 @@ export const pages = [
name: "Diff",
tags: "diff compare comparison image slider",
href: "/components/diff/",
badge: "new",
},
{
name: "Kbd",
Expand All @@ -161,7 +153,6 @@ export const pages = [
name: "Timeline",
tags: "timeline",
href: "/components/timeline/",
badge: "new",
},
],
},
Expand Down Expand Up @@ -208,7 +199,6 @@ export const pages = [
name: "Tab",
tags: "tabs",
href: "/components/tab/",
badge: "updated",
},
],
},
Expand Down Expand Up @@ -240,7 +230,6 @@ export const pages = [
name: "Skeleton",
tags: "skeleton loading placeholder",
href: "/components/skeleton/",
badge: "new",
},
{
name: "Toast",
Expand Down Expand Up @@ -318,7 +307,6 @@ export const pages = [
name: "Divider",
tags: "divider",
href: "/components/divider/",
badge: "updated",
},
{
name: "Drawer",
Expand Down Expand Up @@ -398,7 +386,8 @@ export const pages = [
href: "/store/",
icon: '<svg class="h-5 w-5" width="18" height="18" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M40.0391 22V42H8.03906V22" stroke="currentColor" stroke-width="4" stroke-linecap="butt" stroke-linejoin="bevel"/><path d="M5.84231 13.7766C4.31276 17.7377 7.26307 22 11.5092 22C14.8229 22 17.5276 19.3137 17.5276 16C17.5276 19.3137 20.2139 22 23.5276 22H24.546C27.8597 22 30.546 19.3137 30.546 16C30.546 19.3137 33.2518 22 36.5655 22C40.8139 22 43.767 17.7352 42.2362 13.7723L39.2337 6H8.84523L5.84231 13.7766Z" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="bevel"/></svg>',
badge: "new",
badgeclass: "badge-primary",
badgeclass: "bg-primary/10 text-[inherit] border-transparent uppercase font-sans font-bold",
highlight: true,
},
{
name: "Blog",
Expand Down

0 comments on commit f4269b8

Please sign in to comment.