From de80bedaf385ef9b6d7140f5f61ae37f5619ace4 Mon Sep 17 00:00:00 2001 From: Chanatip Kowsurat <141796254+NhongSun@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:18:58 +0700 Subject: [PATCH] Sun/feat/navbar (#725) * feat: navbar components * feat: github mark * feat: navbar option * feat: border * refactor: center nav items * feat: add link to github mark * feat: collapsible * refactor: typography * feat: responsive * fix: import component * refactor: collapsible * fix: minor bugs * feat: sidebar * fix: navItems * refactor: move files * feat: story book * fix: shorten display name * refactor: shorten code * fix: responsive * fix: style * refactor: move file * fix: migrate to svelte 5 * fix: lint fix * fix: lint fix + small bugs * refactor: typography * fix: small bugs --- apps/web/src/routes/+page.svelte | 4 + .../atom/collapsible/collapsible.svelte | 22 +++ .../src/components/atom/collapsible/index.ts | 7 + .../src/components/organism/navbar/index.ts | 7 + .../organism/navbar/navbar.stories.svelte | 41 ++++ .../components/organism/navbar/navbar.svelte | 184 ++++++++++++++++++ 6 files changed, 265 insertions(+) create mode 100644 packages/ui/src/components/atom/collapsible/collapsible.svelte create mode 100644 packages/ui/src/components/atom/collapsible/index.ts create mode 100644 packages/ui/src/components/organism/navbar/index.ts create mode 100644 packages/ui/src/components/organism/navbar/navbar.stories.svelte create mode 100644 packages/ui/src/components/organism/navbar/navbar.svelte diff --git a/apps/web/src/routes/+page.svelte b/apps/web/src/routes/+page.svelte index 31c7ab225..0510cb604 100644 --- a/apps/web/src/routes/+page.svelte +++ b/apps/web/src/routes/+page.svelte @@ -7,6 +7,7 @@ import { Input } from '@repo/ui/atom/input' import { RecommendedTag } from '@repo/ui/atom/recommended-tag' import { CourseCard } from '@repo/ui/molecule/course-card' + import { Navbar } from '@repo/ui/organism/navbar' let counter = $state(0) @@ -15,6 +16,9 @@ } + + +

Web

diff --git a/packages/ui/src/components/atom/collapsible/collapsible.svelte b/packages/ui/src/components/atom/collapsible/collapsible.svelte new file mode 100644 index 000000000..9b181f8ed --- /dev/null +++ b/packages/ui/src/components/atom/collapsible/collapsible.svelte @@ -0,0 +1,22 @@ + + + +
+

{name}

+ + +
+ + + +
diff --git a/packages/ui/src/components/atom/collapsible/index.ts b/packages/ui/src/components/atom/collapsible/index.ts new file mode 100644 index 000000000..775734eb2 --- /dev/null +++ b/packages/ui/src/components/atom/collapsible/index.ts @@ -0,0 +1,7 @@ +import Root from './collapsible.svelte' + +export { + Root as Collapsible, + // + Root, +} diff --git a/packages/ui/src/components/organism/navbar/index.ts b/packages/ui/src/components/organism/navbar/index.ts new file mode 100644 index 000000000..e91372d03 --- /dev/null +++ b/packages/ui/src/components/organism/navbar/index.ts @@ -0,0 +1,7 @@ +import Root from './navbar.svelte' + +export { + // + Root as Navbar, + Root, +} diff --git a/packages/ui/src/components/organism/navbar/navbar.stories.svelte b/packages/ui/src/components/organism/navbar/navbar.stories.svelte new file mode 100644 index 000000000..1266fc04b --- /dev/null +++ b/packages/ui/src/components/organism/navbar/navbar.stories.svelte @@ -0,0 +1,41 @@ + + + + + + + + + diff --git a/packages/ui/src/components/organism/navbar/navbar.svelte b/packages/ui/src/components/organism/navbar/navbar.svelte new file mode 100644 index 000000000..5cdaf9421 --- /dev/null +++ b/packages/ui/src/components/organism/navbar/navbar.svelte @@ -0,0 +1,184 @@ + + +
+
+ + + + +
+ +
+ + + {#if isLoggedIn} + + + {#each collapseItems as item} +

{item}

+ {/each} +
+ {:else} + + + {/if} + + + +
+ + {#if openSideBar} +
e.key === 'Enter' && toggleSideBar()} + >
+ {/if} + +