From 33dbd18f706e9c8e87fc3e3b7e223fc9233eaba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sucena=20Lopes?= Date: Sat, 16 Nov 2024 16:30:04 +0000 Subject: [PATCH 01/17] feat: first radio-button draft Using CSS only. Co-Authored-By: Sofia Minnemann <93668178+Lauranea@users.noreply.github.com> --- .../{icons => forms}/label-input.stories.ts | 2 +- .../{icons => forms}/label-input.svelte | 0 src/lib/components/forms/radio-button.svelte | 48 +++++++++++++++++++ src/routes/(app)/(home)/+page.svelte | 5 ++ src/routes/(app)/contacts/+page.svelte | 2 +- 5 files changed, 55 insertions(+), 2 deletions(-) rename src/lib/components/{icons => forms}/label-input.stories.ts (92%) rename src/lib/components/{icons => forms}/label-input.svelte (100%) create mode 100644 src/lib/components/forms/radio-button.svelte diff --git a/src/lib/components/icons/label-input.stories.ts b/src/lib/components/forms/label-input.stories.ts similarity index 92% rename from src/lib/components/icons/label-input.stories.ts rename to src/lib/components/forms/label-input.stories.ts index 95339d6b..c5cbc6c6 100644 --- a/src/lib/components/icons/label-input.stories.ts +++ b/src/lib/components/forms/label-input.stories.ts @@ -1,4 +1,4 @@ -import LabelInput from './label-input.svelte'; +import LabelInput from '../label-input.svelte'; export default { title: 'Atoms/LabelInput', diff --git a/src/lib/components/icons/label-input.svelte b/src/lib/components/forms/label-input.svelte similarity index 100% rename from src/lib/components/icons/label-input.svelte rename to src/lib/components/forms/label-input.svelte diff --git a/src/lib/components/forms/radio-button.svelte b/src/lib/components/forms/radio-button.svelte new file mode 100644 index 00000000..387fbc6a --- /dev/null +++ b/src/lib/components/forms/radio-button.svelte @@ -0,0 +1,48 @@ + + +
+

Estatutos

+ +
+ + \ No newline at end of file diff --git a/src/routes/(app)/(home)/+page.svelte b/src/routes/(app)/(home)/+page.svelte index e69de29b..880e3301 100644 --- a/src/routes/(app)/(home)/+page.svelte +++ b/src/routes/(app)/(home)/+page.svelte @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/routes/(app)/contacts/+page.svelte b/src/routes/(app)/contacts/+page.svelte index e98d94c7..0fe54581 100644 --- a/src/routes/(app)/contacts/+page.svelte +++ b/src/routes/(app)/contacts/+page.svelte @@ -1,7 +1,7 @@ From 87169e23586281988b25ac933fbff0c76d9df9c8 Mon Sep 17 00:00:00 2001 From: Lauranea <93668178+Lauranea@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:32:19 +0000 Subject: [PATCH 02/17] feat: start upload picture --- src/lib/components/forms/picture-input.svelte | 37 +++++++++++++++++++ src/lib/components/icons/icons.ts | 4 +- src/routes/(app)/(home)/+page.svelte | 4 +- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/lib/components/forms/picture-input.svelte diff --git a/src/lib/components/forms/picture-input.svelte b/src/lib/components/forms/picture-input.svelte new file mode 100644 index 00000000..088e1cad --- /dev/null +++ b/src/lib/components/forms/picture-input.svelte @@ -0,0 +1,37 @@ + +
+ + {#if avatar} +
+ Avatar + + onFileSelected(e)} bind:this={fileinput}> +
+ {:else} +
+

Adicionar logo *

+ + onFileSelected(e)} bind:this={fileinput}> +
+ {/if} + +
diff --git a/src/lib/components/icons/icons.ts b/src/lib/components/icons/icons.ts index 13f3c118..e4a1135c 100644 --- a/src/lib/components/icons/icons.ts +++ b/src/lib/components/icons/icons.ts @@ -10,6 +10,7 @@ import { } from 'svelte-icons-pack/fa'; import { BiMap } from 'svelte-icons-pack/bi'; import { IoMail, IoClose, IoEye, IoEyeOff } from 'svelte-icons-pack/io'; +import { FiEdit2 } from "svelte-icons-pack/fi"; const Icons = { Instagram: FaBrandsInstagram, @@ -24,7 +25,8 @@ const Icons = { Globe: FaSolidGlobe, Pin: BiMap, Visible: IoEye, - Hidden: IoEyeOff + Hidden: IoEyeOff, + Edit: FiEdit2 }; export default Icons; diff --git a/src/routes/(app)/(home)/+page.svelte b/src/routes/(app)/(home)/+page.svelte index 880e3301..0f07e8aa 100644 --- a/src/routes/(app)/(home)/+page.svelte +++ b/src/routes/(app)/(home)/+page.svelte @@ -1,5 +1,5 @@ - \ No newline at end of file + \ No newline at end of file From c323102770d62936d1073f28d2e1df0bb8da2be8 Mon Sep 17 00:00:00 2001 From: Lauranea <93668178+Lauranea@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:40:45 +0000 Subject: [PATCH 03/17] added more padding --- src/lib/components/forms/picture-input.svelte | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/components/forms/picture-input.svelte b/src/lib/components/forms/picture-input.svelte index 088e1cad..b1aebbf7 100644 --- a/src/lib/components/forms/picture-input.svelte +++ b/src/lib/components/forms/picture-input.svelte @@ -5,22 +5,22 @@ let avatar, fileinput; const onFileSelected =(e)=>{ - let image = e.target.files[0]; - let reader = new FileReader(); - reader.readAsDataURL(image); - reader.onload = e => { - avatar = e.target.result - }; -} - + let image = e.target.files[0]; + let reader = new FileReader(); + reader.readAsDataURL(image); + reader.onload = e => { + avatar = e.target.result; + }; + } +
{#if avatar}
Avatar onFileSelected(e)} bind:this={fileinput}>
@@ -28,7 +28,7 @@

Adicionar logo *

onFileSelected(e)} bind:this={fileinput}>
From cb3e5aa1b55f98b56b90669c6cc36ee77e4874f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sucena=20Lopes?= Date: Sat, 16 Nov 2024 17:55:38 +0000 Subject: [PATCH 04/17] refactor: style radio buttons Replace most CSS with Tailwind. --- src/lib/components/forms/radio-button.svelte | 48 ------------------- src/lib/components/forms/radio-buttons.svelte | 26 ++++++++++ src/routes/(app)/(home)/+page.svelte | 2 +- 3 files changed, 27 insertions(+), 49 deletions(-) delete mode 100644 src/lib/components/forms/radio-button.svelte create mode 100644 src/lib/components/forms/radio-buttons.svelte diff --git a/src/lib/components/forms/radio-button.svelte b/src/lib/components/forms/radio-button.svelte deleted file mode 100644 index 387fbc6a..00000000 --- a/src/lib/components/forms/radio-button.svelte +++ /dev/null @@ -1,48 +0,0 @@ - - -
-

Estatutos

-
    - {#each options as option} - - - {/each} -
-
- - \ No newline at end of file diff --git a/src/lib/components/forms/radio-buttons.svelte b/src/lib/components/forms/radio-buttons.svelte new file mode 100644 index 00000000..a9003f0b --- /dev/null +++ b/src/lib/components/forms/radio-buttons.svelte @@ -0,0 +1,26 @@ + + +
+ {#each options as option} + + + {/each} +
+ + diff --git a/src/routes/(app)/(home)/+page.svelte b/src/routes/(app)/(home)/+page.svelte index 0f07e8aa..5ecf142e 100644 --- a/src/routes/(app)/(home)/+page.svelte +++ b/src/routes/(app)/(home)/+page.svelte @@ -1,5 +1,5 @@ \ No newline at end of file From e40cb213bb8ae630416f889ef274e2ace6188501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sucena=20Lopes?= Date: Sat, 16 Nov 2024 18:04:03 +0000 Subject: [PATCH 05/17] fix: change display of uploaded image --- src/lib/components/forms/picture-input.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/forms/picture-input.svelte b/src/lib/components/forms/picture-input.svelte index b1aebbf7..d65ab5ac 100644 --- a/src/lib/components/forms/picture-input.svelte +++ b/src/lib/components/forms/picture-input.svelte @@ -18,7 +18,7 @@ {#if avatar}
- Avatar + Avatar From bb306928fd8a1beee0776e841e3627574cabf154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sucena=20Lopes?= Date: Sat, 16 Nov 2024 18:44:14 +0000 Subject: [PATCH 06/17] chore: add radio buttons to storybook --- .../components/forms/label-input.stories.ts | 2 +- .../components/forms/radio-buttons.stories.ts | 18 ++++++++++++++++++ src/lib/components/forms/radio-buttons.svelte | 11 ++++------- 3 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/lib/components/forms/radio-buttons.stories.ts diff --git a/src/lib/components/forms/label-input.stories.ts b/src/lib/components/forms/label-input.stories.ts index c5cbc6c6..95339d6b 100644 --- a/src/lib/components/forms/label-input.stories.ts +++ b/src/lib/components/forms/label-input.stories.ts @@ -1,4 +1,4 @@ -import LabelInput from '../label-input.svelte'; +import LabelInput from './label-input.svelte'; export default { title: 'Atoms/LabelInput', diff --git a/src/lib/components/forms/radio-buttons.stories.ts b/src/lib/components/forms/radio-buttons.stories.ts new file mode 100644 index 00000000..ac402783 --- /dev/null +++ b/src/lib/components/forms/radio-buttons.stories.ts @@ -0,0 +1,18 @@ +import RadioButtons from './radio-buttons.svelte'; + +export default { + title: 'Atoms/RadioButtons', + component: RadioButtons, + argTypes: { + options: { control: 'array' } + }, + parameters: { + layout: 'centered', + } +}; + +export const Example = { + args: { + options: ['Hello', 'World'] + } +}; diff --git a/src/lib/components/forms/radio-buttons.svelte b/src/lib/components/forms/radio-buttons.svelte index a9003f0b..e010fa32 100644 --- a/src/lib/components/forms/radio-buttons.svelte +++ b/src/lib/components/forms/radio-buttons.svelte @@ -1,14 +1,11 @@ -
{#each options as option} - +