From 894f331e07e58f9a10cbda5cf0bcc63cc8d1ea34 Mon Sep 17 00:00:00 2001 From: saran13raj Date: Fri, 20 Sep 2024 10:17:51 +0530 Subject: [PATCH 1/7] feat: add toggle component --- src/components/Toggle.astro | 124 ++++++++++++++++++++++++++++++ src/content/pages/base/toggle.mdx | 33 ++++++++ 2 files changed, 157 insertions(+) create mode 100644 src/components/Toggle.astro create mode 100644 src/content/pages/base/toggle.mdx diff --git a/src/components/Toggle.astro b/src/components/Toggle.astro new file mode 100644 index 00000000..98927d03 --- /dev/null +++ b/src/components/Toggle.astro @@ -0,0 +1,124 @@ +--- +import type { Polymorphic } from 'astro/types' +import Icon from 'fulldev-ui/components/Icon.astro' +import Root from 'fulldev-ui/components/Root.astro' + +type Props = Polymorphic<{ as: As }> & { + radius?: 'none' | 'auto' | 'full' + icon?: string + html?: string + text?: string + toggled: boolean +} + +const { + as = 'div', + radius = 'auto', + name, + toggled, + icon, + html, + text, + + ...rest +} = Astro.props +--- + + + + + + diff --git a/src/content/pages/base/toggle.mdx b/src/content/pages/base/toggle.mdx new file mode 100644 index 00000000..340ef56d --- /dev/null +++ b/src/content/pages/base/toggle.mdx @@ -0,0 +1,33 @@ +--- +_layout: ComponentLayout +settings: components + +title: Toggle +--- + +```astro live +--- +import Toggle from 'fulldev-ui/components/Toggle.astro' +--- + + + +``` + +```astro live +--- +import Toggle from 'fulldev-ui/components/Toggle.astro' +--- + + +``` + +```astro live +--- +import Toggle from 'fulldev-ui/components/Toggle.astro' +--- + + + + +``` From 758e2e92124d19f0489bd71272c38ef31d07f60d Mon Sep 17 00:00:00 2001 From: saran13raj Date: Fri, 20 Sep 2024 10:33:13 +0530 Subject: [PATCH 2/7] fix: toggle classname & toggle.mdx content --- src/components/Toggle.astro | 14 +++++++------- src/content/pages/base/toggle.mdx | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/Toggle.astro b/src/components/Toggle.astro index 98927d03..7284c985 100644 --- a/src/components/Toggle.astro +++ b/src/components/Toggle.astro @@ -36,7 +36,7 @@ const { type="checkbox" class="checkbox" /> -
+
@@ -62,7 +62,7 @@ const { height: 0; } - .toggled { + .toggle-content { display: flex; justify-content: center; align-items: center; @@ -80,20 +80,20 @@ const { } } - .checkbox:hover ~ .toggled, - .checkbox:checked ~ .toggled { + .checkbox:hover ~ .toggle-content, + .checkbox:checked ~ .toggle-content { background-color: var(--color-5); } - .checkbox:checked ~ .toggled { + .checkbox:checked ~ .toggle-content { color: var(--base-12); } - .checkbox:checked ~ .toggled .icon { + .checkbox:checked ~ .toggle-content .icon { color: var(--base-12); } - .checkbox:hover:not(:checked) ~ .toggled .icon { + .checkbox:hover:not(:checked) ~ .toggle-content .icon { color: var(--base-9); } diff --git a/src/content/pages/base/toggle.mdx b/src/content/pages/base/toggle.mdx index 340ef56d..ab133eca 100644 --- a/src/content/pages/base/toggle.mdx +++ b/src/content/pages/base/toggle.mdx @@ -5,6 +5,10 @@ settings: components title: Toggle --- +# Toggle + +import PropsTable from 'fulldev-ui/components/docs/PropsTable.astro' + ```astro live --- import Toggle from 'fulldev-ui/components/Toggle.astro' @@ -14,6 +18,12 @@ import Toggle from 'fulldev-ui/components/Toggle.astro' ``` +## Props + + + +## Examples + ```astro live --- import Toggle from 'fulldev-ui/components/Toggle.astro' From 04f815b7d1d2bce049701c620212562b4a0630ee Mon Sep 17 00:00:00 2001 From: saran13raj Date: Sat, 21 Sep 2024 22:03:37 +0530 Subject: [PATCH 3/7] style: add layer to toggle component --- src/components/Toggle.astro | 119 ++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/src/components/Toggle.astro b/src/components/Toggle.astro index 7284c985..2513802e 100644 --- a/src/components/Toggle.astro +++ b/src/components/Toggle.astro @@ -19,7 +19,6 @@ const { icon, html, text, - ...rest } = Astro.props --- @@ -47,78 +46,80 @@ const { From a3acdf99916293ec99097e3351541460c5afd290 Mon Sep 17 00:00:00 2001 From: Jeremy Bosma Date: Tue, 15 Oct 2024 14:09:45 +0200 Subject: [PATCH 4/7] toggle component fix --- src/components/Toggle.astro | 105 +++++++++++++++++------------------- 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/src/components/Toggle.astro b/src/components/Toggle.astro index 2513802e..2bd198fc 100644 --- a/src/components/Toggle.astro +++ b/src/components/Toggle.astro @@ -3,7 +3,7 @@ import type { Polymorphic } from 'astro/types' import Icon from 'fulldev-ui/components/Icon.astro' import Root from 'fulldev-ui/components/Root.astro' -type Props = Polymorphic<{ as: As }> & { +type Props = Polymorphic<{ as: As }> & { radius?: 'none' | 'auto' | 'full' icon?: string html?: string @@ -12,7 +12,6 @@ type Props = Polymorphic<{ as: As }> & { } const { - as = 'div', radius = 'auto', name, toggled, @@ -24,82 +23,78 @@ const { --- - + + + + + + + +