From 3a9975ce230a892a8af0286ffa81776d03a8361b Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 28 Sep 2022 21:31:41 +0800 Subject: feat: Add switch component --- apps/kit/src/lib/components/switch.svelte | 135 ++++++++++++++++++++++++++ apps/kit/src/routes/book/+layout.svelte | 6 ++ apps/kit/src/routes/book/toggles/+page.svelte | 27 ++++++ 3 files changed, 168 insertions(+) create mode 100644 apps/kit/src/lib/components/switch.svelte create mode 100644 apps/kit/src/routes/book/toggles/+page.svelte (limited to 'apps') diff --git a/apps/kit/src/lib/components/switch.svelte b/apps/kit/src/lib/components/switch.svelte new file mode 100644 index 0000000..8a90dba --- /dev/null +++ b/apps/kit/src/lib/components/switch.svelte @@ -0,0 +1,135 @@ + + + + +
+ {#if hasLabelOrDescription && !rightAlignedLabelDescription} + + {#if label} + {label} + {/if} + {#if description} + {description} + {/if} + + {/if} + {#if type === "short"} + + {:else if type === "icon"} + + {:else if type === "default"} + + {/if} + {#if hasLabelOrDescription && rightAlignedLabelDescription} + + {#if label} + {label} + {/if} + {#if description} + {description} + {/if} + + {/if} +
diff --git a/apps/kit/src/routes/book/+layout.svelte b/apps/kit/src/routes/book/+layout.svelte index fc55d9d..02d03b6 100644 --- a/apps/kit/src/routes/book/+layout.svelte +++ b/apps/kit/src/routes/book/+layout.svelte @@ -17,6 +17,12 @@ class:active={$page.url.pathname.startsWith("/book/buttons")} >Buttons + Toggles
diff --git a/apps/kit/src/routes/book/toggles/+page.svelte b/apps/kit/src/routes/book/toggles/+page.svelte new file mode 100644 index 0000000..94228b4 --- /dev/null +++ b/apps/kit/src/routes/book/toggles/+page.svelte @@ -0,0 +1,27 @@ + + +
+

Default

+ +
+
+

Short

+ +
+
+

Icon

+ +
+
+

Label / Description

+
+ +
+
+ +
+

Label / Description (right aligned)

+ +
\ No newline at end of file -- cgit v1.3