From 047ea63a9b0cb61f495231e1cf16dc70a378c813 Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:33:46 +0200 Subject: [PATCH 1/6] component: note --- src/lib/assets/icons/check-circle.svg | 3 ++ src/lib/assets/icons/index.ts | 8 +++- src/lib/assets/icons/information.svg | 3 ++ src/lib/assets/icons/warning.svg | 3 ++ src/lib/components/ui/note/index.ts | 48 ++++++++++++++++++++ src/lib/components/ui/note/note.svelte | 36 +++++++++++++++ src/lib/config/sitemap.ts | 2 +- src/routes/note/+page.svelte | 63 +++++++++++++++++++++++++- src/routes/note/+page.ts | 21 +++++++++ src/routes/note/action.svelte | 16 +++++++ src/routes/note/cyan.svelte | 28 ++++++++++++ src/routes/note/default.svelte | 9 ++++ src/routes/note/disabled.svelte | 17 +++++++ src/routes/note/error.svelte | 28 ++++++++++++ src/routes/note/secondary.svelte | 28 ++++++++++++ src/routes/note/success.svelte | 28 ++++++++++++ src/routes/note/violet.svelte | 28 ++++++++++++ src/routes/note/warning.svelte | 28 ++++++++++++ 18 files changed, 394 insertions(+), 3 deletions(-) create mode 100644 src/lib/assets/icons/check-circle.svg create mode 100644 src/lib/assets/icons/information.svg create mode 100644 src/lib/assets/icons/warning.svg create mode 100644 src/lib/components/ui/note/index.ts create mode 100644 src/lib/components/ui/note/note.svelte create mode 100644 src/routes/note/+page.ts create mode 100644 src/routes/note/action.svelte create mode 100644 src/routes/note/cyan.svelte create mode 100644 src/routes/note/default.svelte create mode 100644 src/routes/note/disabled.svelte create mode 100644 src/routes/note/error.svelte create mode 100644 src/routes/note/secondary.svelte create mode 100644 src/routes/note/success.svelte create mode 100644 src/routes/note/violet.svelte create mode 100644 src/routes/note/warning.svelte diff --git a/src/lib/assets/icons/check-circle.svg b/src/lib/assets/icons/check-circle.svg new file mode 100644 index 0000000..7f3025d --- /dev/null +++ b/src/lib/assets/icons/check-circle.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/assets/icons/index.ts b/src/lib/assets/icons/index.ts index 4e0659b..770ab46 100644 --- a/src/lib/assets/icons/index.ts +++ b/src/lib/assets/icons/index.ts @@ -9,6 +9,7 @@ import BrandAssets from './brand-assets.svg?component'; import ChartBarMiddle from './chart-bar-middle.svg?component'; import ChartBarPeak from './chart-bar-peak.svg?component'; import ChartTrendingDown from './chart-trending-down.svg?component'; +import CheckCircle from './check-circle.svg?component'; import Check from './check.svg?component'; import ChevronLeft from './chevron-left.svg?component'; import ChevronRightSmall from './chevron-right-small.svg?component'; @@ -29,6 +30,7 @@ import GitBranch from './git-branch.svg?component'; import Globe from './globe.svg?component'; import GridSquare from './grid-square.svg?component'; import Inbox from './inbox.svg?component'; +import Information from './information.svg?component'; import Key from './key.svg?component'; import Link from './link.svg?component'; import LoaderCircle from './loader-circle.svg?component'; @@ -56,6 +58,7 @@ import Tabs from './tabs.svg?component'; import ThemeSwitchDark from './theme-switch-dark.svg?component'; import ThemeSwitchLight from './theme-switch-light.svg?component'; import ThemeSwitchSystem from './theme-switch-system.svg?component'; +import Warning from './warning.svg?component'; export const Icons = { Accessibility, @@ -69,6 +72,7 @@ export const Icons = { ChartBarMiddle, ChartBarPeak, ChartTrendingDown, + CheckCircle, Check, ChevronLeft, ChevronRightSmall, @@ -89,6 +93,7 @@ export const Icons = { Globe, GridSquare, Inbox, + Information, Key, Link, LoaderCircle, @@ -115,5 +120,6 @@ export const Icons = { Tabs, ThemeSwitchDark, ThemeSwitchLight, - ThemeSwitchSystem + ThemeSwitchSystem, + Warning }; diff --git a/src/lib/assets/icons/information.svg b/src/lib/assets/icons/information.svg new file mode 100644 index 0000000..c1401e3 --- /dev/null +++ b/src/lib/assets/icons/information.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/assets/icons/warning.svg b/src/lib/assets/icons/warning.svg new file mode 100644 index 0000000..12ac079 --- /dev/null +++ b/src/lib/assets/icons/warning.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/components/ui/note/index.ts b/src/lib/components/ui/note/index.ts new file mode 100644 index 0000000..3c7fff6 --- /dev/null +++ b/src/lib/components/ui/note/index.ts @@ -0,0 +1,48 @@ +import { type VariantProps, tv } from 'tailwind-variants'; + +export { default as Note } from './note.svelte'; + +export const note_variants = tv({ + base: 'flex grow items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 [&>div>a]:hover:underline [&>div>a]:data-[disabled=true]:text-gray-900', + variants: { + variant: { + secondary: 'bg-transparent text-gray-900 selection:bg-gray-700 [&>div>a]:text-gray-1000', + success: 'border-blue-400 text-blue-900 selection:bg-blue-700 [&>div>a]:text-blue-1000', + error: 'border-red-400 text-red-900 selection:bg-red-700 [&>div>a]:text-red-1000', + warning: 'border-amber-400 text-amber-900 selection:bg-amber-700 [&>div>a]:text-amber-1000', + violet: + 'border-purple-400 text-purple-900 selection:bg-purple-700 [&>div>a]:text-purple-1000', + cyan: 'border-teal-400 text-teal-900 selection:bg-teal-700 [&>div>a]:text-teal-1000' + }, + size: { + sm: 'min-h-[34px] px-2 py-1.5 text-[13px] leading-6', + md: 'min-h-10 px-3 py-2 text-[14px] leading-6', + lg: 'min-h-12 px-3 py-[11px] text-base' + }, + fill: { true: true, false: false } + }, + compoundVariants: [ + { variant: 'secondary', fill: true, class: 'bg-gray-200' }, + { variant: 'success', fill: true, class: 'bg-blue-200' }, + { variant: 'error', fill: true, class: 'bg-red-200' }, + { variant: 'warning', fill: true, class: 'bg-amber-200' }, + { variant: 'violet', fill: true, class: 'bg-purple-200' }, + { variant: 'cyan', fill: true, class: 'bg-teal-200' } + ], + defaultVariants: { + variant: 'secondary', + size: 'md', + fill: false + } +}); + +type Variant = VariantProps['variant']; +type Size = VariantProps['size']; +type Fill = VariantProps['fill']; + +export type Props = { + variant?: Variant; + size?: Size; + fill?: Fill; + disabled?: boolean; +}; diff --git a/src/lib/components/ui/note/note.svelte b/src/lib/components/ui/note/note.svelte new file mode 100644 index 0000000..3a3f688 --- /dev/null +++ b/src/lib/components/ui/note/note.svelte @@ -0,0 +1,36 @@ + + +
+
+ + {#if variant === 'secondary' || variant === 'violet' || variant === 'cyan'} + + +
+ +
diff --git a/src/lib/config/sitemap.ts b/src/lib/config/sitemap.ts index c20866d..de6fc2f 100644 --- a/src/lib/config/sitemap.ts +++ b/src/lib/config/sitemap.ts @@ -170,7 +170,7 @@ export const aside_items: Aside = { { title: 'Note', href: '/note', - status: 'soon' + status: 'draft' }, { title: 'Pagination', diff --git a/src/routes/note/+page.svelte b/src/routes/note/+page.svelte index ab6f847..9b6f649 100644 --- a/src/routes/note/+page.svelte +++ b/src/routes/note/+page.svelte @@ -1 +1,62 @@ -

note

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/routes/note/+page.ts b/src/routes/note/+page.ts new file mode 100644 index 0000000..8a0fa7c --- /dev/null +++ b/src/routes/note/+page.ts @@ -0,0 +1,21 @@ +import type { MetaTagsProps } from 'svelte-meta-tags'; + +export function load() { + const title = 'Note'; + const description = 'Display text that requires attention or provides additional information.'; + + const pageMetaTags = Object.freeze({ + title, + description, + openGraph: { + title, + description + } + }) satisfies MetaTagsProps; + + return { + pageMetaTags, + title, + description + }; +} diff --git a/src/routes/note/action.svelte b/src/routes/note/action.svelte new file mode 100644 index 0000000..71dd18a --- /dev/null +++ b/src/routes/note/action.svelte @@ -0,0 +1,16 @@ + + +
+ + This note details some information. + + + + This note details a large amount information that could potentially wrap into two or more lines, + forcing the height of the Note to be larger. + + +
diff --git a/src/routes/note/cyan.svelte b/src/routes/note/cyan.svelte new file mode 100644 index 0000000..d90d5da --- /dev/null +++ b/src/routes/note/cyan.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some cyan information. + + This note details some cyan information. + + + + This note details some cyan information. Check the documentation to learn + more. + + + This filled note details some cyan information. + + This filled note details some cyan information. + + + + This filled note details some cyan information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/default.svelte b/src/routes/note/default.svelte new file mode 100644 index 0000000..18124d0 --- /dev/null +++ b/src/routes/note/default.svelte @@ -0,0 +1,9 @@ + + +
+ A small note. + A default note. + A large note. +
diff --git a/src/routes/note/disabled.svelte b/src/routes/note/disabled.svelte new file mode 100644 index 0000000..7421ab3 --- /dev/null +++ b/src/routes/note/disabled.svelte @@ -0,0 +1,17 @@ + + +
+ + This note details a warning. + + + + This filled note details some success information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/error.svelte b/src/routes/note/error.svelte new file mode 100644 index 0000000..d87b30c --- /dev/null +++ b/src/routes/note/error.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some error information. + + This note details some error information. + + + + This note details some error information. Check the documentation to learn + more. + + + This filled note details some error information. + + This filled note details some error information. + + + + This filled note details some error information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/secondary.svelte b/src/routes/note/secondary.svelte new file mode 100644 index 0000000..dbe00e5 --- /dev/null +++ b/src/routes/note/secondary.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some secondary information. + + This note details some secondary information. + + + + This note details some secondary information. Check the documentation to learn + more. + + + This filled note details some secondary information. + + This filled note details some secondary information. + + + + This filled note details some secondary information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/success.svelte b/src/routes/note/success.svelte new file mode 100644 index 0000000..879f9c6 --- /dev/null +++ b/src/routes/note/success.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some success information. + + This note details some success information. + + + + This note details some success information. Check the documentation to learn + more. + + + This filled note details some success information. + + This filled note details some success information. + + + + This filled note details some success information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/violet.svelte b/src/routes/note/violet.svelte new file mode 100644 index 0000000..1a42ffb --- /dev/null +++ b/src/routes/note/violet.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some violet information. + + This note details some violet information. + + + + This note details some violet information. Check the documentation to learn + more. + + + This filled note details some violet information. + + This filled note details some violet information. + + + + This filled note details some violet information. Check + the documentation to learn more. + + +
diff --git a/src/routes/note/warning.svelte b/src/routes/note/warning.svelte new file mode 100644 index 0000000..152d70e --- /dev/null +++ b/src/routes/note/warning.svelte @@ -0,0 +1,28 @@ + + +
+ This note details some warning information. + + This note details some warning information. + + + + This note details some warning information. Check the documentation to learn + more. + + + This filled note details some warning information. + + This filled note details some warning information. + + + + This filled note details some warning information. Check + the documentation to learn more. + + +
From 9ce91346c67b525ebaba7632d3a7f59175fd9f16 Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:16:26 +0200 Subject: [PATCH 2/6] disabled --- src/lib/components/ui/note/index.ts | 2 +- src/lib/components/ui/note/note.svelte | 2 +- src/routes/note/disabled.svelte | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/ui/note/index.ts b/src/lib/components/ui/note/index.ts index 3c7fff6..eccedb1 100644 --- a/src/lib/components/ui/note/index.ts +++ b/src/lib/components/ui/note/index.ts @@ -3,7 +3,7 @@ import { type VariantProps, tv } from 'tailwind-variants'; export { default as Note } from './note.svelte'; export const note_variants = tv({ - base: 'flex grow items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 [&>div>a]:hover:underline [&>div>a]:data-[disabled=true]:text-gray-900', + base: 'flex grow items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 hover:[&>div>a]:underline [&>div>a]:data-[disabled=true]:text-gray-900', variants: { variant: { secondary: 'bg-transparent text-gray-900 selection:bg-gray-700 [&>div>a]:text-gray-1000', diff --git a/src/lib/components/ui/note/note.svelte b/src/lib/components/ui/note/note.svelte index 3a3f688..b58a490 100644 --- a/src/lib/components/ui/note/note.svelte +++ b/src/lib/components/ui/note/note.svelte @@ -32,5 +32,5 @@ - + diff --git a/src/routes/note/disabled.svelte b/src/routes/note/disabled.svelte index 7421ab3..250a76f 100644 --- a/src/routes/note/disabled.svelte +++ b/src/routes/note/disabled.svelte @@ -7,11 +7,11 @@
This note details a warning. - + This filled note details some success information. Check the documentation to learn more. - +
From 77c7e6e10e37d781f7f800458ac322053dfa1f21 Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:49:36 +0200 Subject: [PATCH 3/6] labels --- src/lib/components/ui/note/index.ts | 16 +++++---- src/lib/components/ui/note/note.svelte | 31 ++++++++++------- src/routes/note/+page.svelte | 6 ++++ src/routes/note/labels.svelte | 47 ++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 19 deletions(-) create mode 100644 src/routes/note/labels.svelte diff --git a/src/lib/components/ui/note/index.ts b/src/lib/components/ui/note/index.ts index eccedb1..1e216a0 100644 --- a/src/lib/components/ui/note/index.ts +++ b/src/lib/components/ui/note/index.ts @@ -3,16 +3,17 @@ import { type VariantProps, tv } from 'tailwind-variants'; export { default as Note } from './note.svelte'; export const note_variants = tv({ - base: 'flex grow items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 hover:[&>div>a]:underline [&>div>a]:data-[disabled=true]:text-gray-900', + base: 'flex grow flex-wrap items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 hover:[&>div>div>a]:underline [&>div>div>a]:data-[disabled=true]:text-gray-900', variants: { variant: { - secondary: 'bg-transparent text-gray-900 selection:bg-gray-700 [&>div>a]:text-gray-1000', - success: 'border-blue-400 text-blue-900 selection:bg-blue-700 [&>div>a]:text-blue-1000', - error: 'border-red-400 text-red-900 selection:bg-red-700 [&>div>a]:text-red-1000', - warning: 'border-amber-400 text-amber-900 selection:bg-amber-700 [&>div>a]:text-amber-1000', + secondary: 'bg-transparent text-gray-900 selection:bg-gray-700 [&>div>div>a]:text-gray-1000', + success: 'border-blue-400 text-blue-900 selection:bg-blue-700 [&>div>div>a]:text-blue-1000', + error: 'border-red-400 text-red-900 selection:bg-red-700 [&>div>div>a]:text-red-1000', + warning: + 'border-amber-400 text-amber-900 selection:bg-amber-700 [&>div>div>a]:text-amber-1000', violet: - 'border-purple-400 text-purple-900 selection:bg-purple-700 [&>div>a]:text-purple-1000', - cyan: 'border-teal-400 text-teal-900 selection:bg-teal-700 [&>div>a]:text-teal-1000' + 'border-purple-400 text-purple-900 selection:bg-purple-700 [&>div>div>a]:text-purple-1000', + cyan: 'border-teal-400 text-teal-900 selection:bg-teal-700 [&>div>div>a]:text-teal-1000' }, size: { sm: 'min-h-[34px] px-2 py-1.5 text-[13px] leading-6', @@ -45,4 +46,5 @@ export type Props = { size?: Size; fill?: Fill; disabled?: boolean; + label?: string | boolean; }; diff --git a/src/lib/components/ui/note/note.svelte b/src/lib/components/ui/note/note.svelte index b58a490..7ced4ef 100644 --- a/src/lib/components/ui/note/note.svelte +++ b/src/lib/components/ui/note/note.svelte @@ -10,6 +10,7 @@ export let size: $$Props['size'] = 'md'; export let fill: $$Props['fill'] = false; export let disabled: $$Props['disabled'] = false; + export let label: $$Props['label'] = undefined; export { class_name as class }; @@ -19,18 +20,24 @@ {...$$restProps} >
- - {#if variant === 'secondary' || variant === 'violet' || variant === 'cyan'} - - + {#if label} + {label} + {:else if label !== false} + + {#if variant === 'secondary' || variant === 'violet' || variant === 'cyan'} + + {/if} +
+ +
diff --git a/src/routes/note/+page.svelte b/src/routes/note/+page.svelte index 9b6f649..1c3e92b 100644 --- a/src/routes/note/+page.svelte +++ b/src/routes/note/+page.svelte @@ -11,6 +11,8 @@ import disabled_code from './disabled.svelte?raw'; import Error from './error.svelte'; import error_code from './error.svelte?raw'; + import Labels from './labels.svelte'; + import labels_code from './labels.svelte?raw'; import Secondary from './secondary.svelte'; import secondary_code from './secondary.svelte?raw'; import Success from './success.svelte'; @@ -59,4 +61,8 @@ + + + + diff --git a/src/routes/note/labels.svelte b/src/routes/note/labels.svelte new file mode 100644 index 0000000..3d43f0c --- /dev/null +++ b/src/routes/note/labels.svelte @@ -0,0 +1,47 @@ + + +
+
+

Default label

+ {#each variants as variant} + This is a note of variant `{variant}`. + + + This is a fill note of variant `{variant}`. + + {/each} +
+ +
+

Custom label

+ {#each variants as variant} + This is a note of variant `{variant}`. + + + This is a fill note of variant `{variant}`. + + {/each} +
+ +
+

No label

+ {#each variants as variant} + This is a note of variant `{variant}`. + + + This is a fill note of variant `{variant}`. + + {/each} +
+
From 1a101a9a619a247edd27b4a365d7bc4bf0dd0efa Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:54:56 +0200 Subject: [PATCH 4/6] oops --- src/lib/components/ui/note/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/ui/note/index.ts b/src/lib/components/ui/note/index.ts index 1e216a0..42cf7dc 100644 --- a/src/lib/components/ui/note/index.ts +++ b/src/lib/components/ui/note/index.ts @@ -3,7 +3,7 @@ import { type VariantProps, tv } from 'tailwind-variants'; export { default as Note } from './note.svelte'; export const note_variants = tv({ - base: 'flex grow flex-wrap items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 hover:[&>div>div>a]:underline [&>div>div>a]:data-[disabled=true]:text-gray-900', + base: 'flex grow flex-wrap items-center justify-between gap-3 text-pretty rounded-md border data-[disabled=true]:border-gray-alpha-200 data-[disabled=true]:bg-transparent data-[disabled=true]:text-gray-700 sm:flex-nowrap hover:[&>div>div>a]:underline [&>div>div>a]:data-[disabled=true]:text-gray-900', variants: { variant: { secondary: 'bg-transparent text-gray-900 selection:bg-gray-700 [&>div>div>a]:text-gray-1000', From d98410e693e873cd935d020d43df6ef121e7de88 Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:58:16 +0200 Subject: [PATCH 5/6] meh --- src/lib/components/ui/note/note.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/ui/note/note.svelte b/src/lib/components/ui/note/note.svelte index 7ced4ef..889a589 100644 --- a/src/lib/components/ui/note/note.svelte +++ b/src/lib/components/ui/note/note.svelte @@ -21,7 +21,7 @@ >
{#if label} - {label} + {label}: {:else if label !== false} {#if variant === 'secondary' || variant === 'violet' || variant === 'cyan'} From 2a225e1e849fcee4449077b6ce09db91dc071fb3 Mon Sep 17 00:00:00 2001 From: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:15:45 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/note/default.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/note/default.svelte b/src/routes/note/default.svelte index 18124d0..3c23194 100644 --- a/src/routes/note/default.svelte +++ b/src/routes/note/default.svelte @@ -2,7 +2,7 @@ import { Note } from '$lib/components/ui/note'; -
+
A small note. A default note. A large note.