From 515835bb8e505c85e4cf54b8f0cb1685b614d75a Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Fri, 3 May 2024 15:49:29 +0200 Subject: [PATCH 01/14] feat: wip card structure --- public/icons/gasOutline.tsx | 17 +++++++ src/components/card/card.stories.tsx | 73 ++++++++++++++++++++++++++++ src/components/card/card.tsx | 60 +++++++++++++++++++++++ src/components/card/styles.ts | 8 +++ src/components/card/types.ts | 8 +++ 5 files changed, 166 insertions(+) create mode 100644 public/icons/gasOutline.tsx create mode 100644 src/components/card/card.stories.tsx create mode 100644 src/components/card/card.tsx create mode 100644 src/components/card/styles.ts create mode 100644 src/components/card/types.ts diff --git a/public/icons/gasOutline.tsx b/public/icons/gasOutline.tsx new file mode 100644 index 0000000..ce390bf --- /dev/null +++ b/public/icons/gasOutline.tsx @@ -0,0 +1,17 @@ +import * as React from "react"; +import { SVGProps } from "react"; + +export const GasOutline = (props: SVGProps) => ( + + + + +); diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx new file mode 100644 index 0000000..0470c04 --- /dev/null +++ b/src/components/card/card.stories.tsx @@ -0,0 +1,73 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { Card, CardButton, CardContent, CardHeader } from "./card"; +import { Badge } from "../badge/badge"; +import { Text } from "../text/text"; +import { GasOutline } from "../../../public/icons/gasOutline"; +import { Alert } from "../../../public/icons/alert"; +import { Title } from "../title"; + +const meta: Meta = { + // component: Card, +}; + +export default meta; +type Story = StoryObj; + +export const Template: Story = { + render: (args) => ( + + + A rischio sospensione + + +
+
+ + + Gas + +
+ + Pizza Risorgimento 3, Amandola (FM) + +
+
+ +
+ + + Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo. + +
+ + Per questa fornitura pagherai + + + 65,46 € + + +
+ + 57 + +
+ + , 99 € + + + al mese, + + + per 12 mesi. + +
+
+
+ +
+ ), +}; diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx new file mode 100644 index 0000000..55a19ed --- /dev/null +++ b/src/components/card/card.tsx @@ -0,0 +1,60 @@ +import classNames from "classnames"; +import { forwardRef } from "react"; +import { CardHeaderProps, CardProps } from "./types"; +import { cardHeaderStyles, cardStyles } from "./styles"; +import { Cta } from "../cta/cta"; + +const Card = forwardRef( + ({ className, children, ...rest }, ref) => { + return ( +
+ {children} +
+ ); + } +); + +Card.displayName = "Card"; + +const CardHeader = forwardRef( + ({ className, children, ...rest }, ref) => { + return ( +
+ {children} +
+ ); + } +); + +CardHeader.displayName = "CardHeader"; + +const CardContent = forwardRef( + ({ className, ...rest }, ref) => { + return ( +
+ ); + } +); + +CardContent.displayName = "CardContent"; + +const CardButton = forwardRef( + ({ className, ...rest }, ref) => { + return ( + Monitora e gestisci + //
+ ); + } +); + +CardButton.displayName = "CardButton"; + +export { Card, CardHeader, CardContent, CardButton }; diff --git a/src/components/card/styles.ts b/src/components/card/styles.ts new file mode 100644 index 0000000..17658fa --- /dev/null +++ b/src/components/card/styles.ts @@ -0,0 +1,8 @@ +import { cva } from "class-variance-authority"; + +const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-4"); +const cardHeaderStyles = cva(""); +const cardContentStyles = cva(""); +const cardButtonStyles = cva(""); + +export { cardStyles, cardHeaderStyles }; diff --git a/src/components/card/types.ts b/src/components/card/types.ts new file mode 100644 index 0000000..f5e3570 --- /dev/null +++ b/src/components/card/types.ts @@ -0,0 +1,8 @@ +import { VariantProps } from "class-variance-authority"; +import { cardStyles } from "./styles"; +import { ComponentPropsWithoutRef } from "react"; + +export type CardHeaderProps = ComponentPropsWithoutRef<"div"> & + VariantProps; +export type CardProps = ComponentPropsWithoutRef<"div"> & + VariantProps; From 997d337b45bcee400e0724d979fd85ff8e27a8e5 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Fri, 3 May 2024 16:07:44 +0200 Subject: [PATCH 02/14] fix: adjust style --- src/components/card/card.stories.tsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 0470c04..7bcbd95 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -14,14 +14,16 @@ export default meta; type Story = StoryObj; export const Template: Story = { - render: (args) => ( + render: () => ( - - A rischio sospensione - +
+ + A rischio sospensione + +
-
+
Gas @@ -33,28 +35,24 @@ export const Template: Story = {
-
+
Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo.
- + Per questa fornitura pagherai - + 65,46 €
- + <Title as="h1" className="leading-none mt-[-5px]"> 57 -
+
, 99 € From fc8590e19dec861f0d3c2478a6824a1e55b49e0a Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Fri, 3 May 2024 16:21:40 +0200 Subject: [PATCH 03/14] fix: minor --- src/components/card/card.stories.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 7bcbd95..f868153 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -47,14 +47,13 @@ export const Template: Story = { 65,46 € - -
+
57
- , 99 € + ,99 € al mese, From 321bdba785580491098c74bcb702f8d831095122 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Mon, 6 May 2024 12:20:02 +0200 Subject: [PATCH 04/14] fix: pr fix --- public/icons/gasOutline.tsx | 8 ++------ src/components/card/card.stories.tsx | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/public/icons/gasOutline.tsx b/public/icons/gasOutline.tsx index ce390bf..6121e9b 100644 --- a/public/icons/gasOutline.tsx +++ b/public/icons/gasOutline.tsx @@ -2,16 +2,12 @@ import * as React from "react"; import { SVGProps } from "react"; export const GasOutline = (props: SVGProps) => ( - - + + ); diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index f868153..80cec31 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -24,7 +24,7 @@ export const Template: Story = {
- + Gas @@ -36,7 +36,7 @@ export const Template: Story = {
- + Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo. From 5c469c0c557c4918fdee5f60b843fcb5c8de2588 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Mon, 6 May 2024 12:28:05 +0200 Subject: [PATCH 05/14] task: add indexes file, adjust logic --- src/components/card/card.stories.tsx | 12 +++++++----- src/components/card/card.tsx | 26 ++++++++++++-------------- src/components/card/index.ts | 1 + src/components/card/styles.ts | 5 +---- src/components/card/types.ts | 2 -- src/components/cta/cta.tsx | 2 +- 6 files changed, 22 insertions(+), 26 deletions(-) create mode 100644 src/components/card/index.ts diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 80cec31..2058584 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -1,10 +1,10 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { Card, CardButton, CardContent, CardHeader } from "./card"; +import { Alert, GasOutline } from "../../../public/icons"; import { Badge } from "../badge/badge"; -import { Text } from "../text/text"; -import { GasOutline } from "../../../public/icons/gasOutline"; -import { Alert } from "../../../public/icons/alert"; +import { Cta } from "../cta"; +import { Text } from "../text"; import { Title } from "../title"; +import { Card, CardButton, CardContent, CardHeader } from "./card"; const meta: Meta = { // component: Card, @@ -64,7 +64,9 @@ export const Template: Story = {
- + + Monitora e gestisci + ), }; diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx index 55a19ed..ce10e04 100644 --- a/src/components/card/card.tsx +++ b/src/components/card/card.tsx @@ -1,8 +1,7 @@ import classNames from "classnames"; import { forwardRef } from "react"; -import { CardHeaderProps, CardProps } from "./types"; -import { cardHeaderStyles, cardStyles } from "./styles"; -import { Cta } from "../cta/cta"; +import { CardProps } from "./types"; +import { cardStyles } from "./styles"; const Card = forwardRef( ({ className, children, ...rest }, ref) => { @@ -20,14 +19,10 @@ const Card = forwardRef( Card.displayName = "Card"; -const CardHeader = forwardRef( +const CardHeader = forwardRef( ({ className, children, ...rest }, ref) => { return ( -
+
{children}
); @@ -37,9 +32,11 @@ const CardHeader = forwardRef( CardHeader.displayName = "CardHeader"; const CardContent = forwardRef( - ({ className, ...rest }, ref) => { + ({ className, children, ...rest }, ref) => { return ( -
+
+ {children} +
); } ); @@ -47,10 +44,11 @@ const CardContent = forwardRef( CardContent.displayName = "CardContent"; const CardButton = forwardRef( - ({ className, ...rest }, ref) => { + ({ className, children, ...rest }, ref) => { return ( - Monitora e gestisci - //
+
+ {children} +
); } ); diff --git a/src/components/card/index.ts b/src/components/card/index.ts new file mode 100644 index 0000000..738731b --- /dev/null +++ b/src/components/card/index.ts @@ -0,0 +1 @@ +export { Card } from "./card"; diff --git a/src/components/card/styles.ts b/src/components/card/styles.ts index 17658fa..74f5e7a 100644 --- a/src/components/card/styles.ts +++ b/src/components/card/styles.ts @@ -1,8 +1,5 @@ import { cva } from "class-variance-authority"; const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-4"); -const cardHeaderStyles = cva(""); -const cardContentStyles = cva(""); -const cardButtonStyles = cva(""); -export { cardStyles, cardHeaderStyles }; +export { cardStyles }; diff --git a/src/components/card/types.ts b/src/components/card/types.ts index f5e3570..19b5dfb 100644 --- a/src/components/card/types.ts +++ b/src/components/card/types.ts @@ -2,7 +2,5 @@ import { VariantProps } from "class-variance-authority"; import { cardStyles } from "./styles"; import { ComponentPropsWithoutRef } from "react"; -export type CardHeaderProps = ComponentPropsWithoutRef<"div"> & - VariantProps; export type CardProps = ComponentPropsWithoutRef<"div"> & VariantProps; diff --git a/src/components/cta/cta.tsx b/src/components/cta/cta.tsx index 561f367..b3e3847 100644 --- a/src/components/cta/cta.tsx +++ b/src/components/cta/cta.tsx @@ -1,7 +1,7 @@ import classNames from "classnames"; import { forwardRef } from "react"; -import { ArrowRight } from "../../../public/icons/arrow-right"; +import { ArrowRight } from "../../../public/icons"; import { Text } from "../text"; import { ctaStyles } from "./styles"; import { CtaProps } from "./types"; From e2c8672ef5d6098343dfaf0669bbb47475d7e73e Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Tue, 7 May 2024 09:52:41 +0200 Subject: [PATCH 06/14] fix: change card button naming --- src/components/card/card.stories.tsx | 6 +++--- src/components/card/card.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 2058584..74a917d 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -4,7 +4,7 @@ import { Badge } from "../badge/badge"; import { Cta } from "../cta"; import { Text } from "../text"; import { Title } from "../title"; -import { Card, CardButton, CardContent, CardHeader } from "./card"; +import { Card, CardFooter, CardContent, CardHeader } from "./card"; const meta: Meta = { // component: Card, @@ -64,9 +64,9 @@ export const Template: Story = {
- + Monitora e gestisci - + ), }; diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx index ce10e04..ee559e4 100644 --- a/src/components/card/card.tsx +++ b/src/components/card/card.tsx @@ -43,7 +43,7 @@ const CardContent = forwardRef( CardContent.displayName = "CardContent"; -const CardButton = forwardRef( +const CardFooter = forwardRef( ({ className, children, ...rest }, ref) => { return (
@@ -53,6 +53,6 @@ const CardButton = forwardRef( } ); -CardButton.displayName = "CardButton"; +CardFooter.displayName = "CardFooter"; -export { Card, CardHeader, CardContent, CardButton }; +export { Card, CardHeader, CardContent, CardFooter }; From 272db5d9e8b8bac08d13853768650c780fc049a7 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Tue, 7 May 2024 09:55:41 +0200 Subject: [PATCH 07/14] fix: pr fix --- src/components/card/card.stories.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 74a917d..c5fbd29 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -6,16 +6,14 @@ import { Text } from "../text"; import { Title } from "../title"; import { Card, CardFooter, CardContent, CardHeader } from "./card"; -const meta: Meta = { - // component: Card, -}; +const meta: Meta = {}; export default meta; type Story = StoryObj; export const Template: Story = { render: () => ( - +
A rischio sospensione From 78f167eb322a89e893b8a1d343b0ce31a973aaac Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Tue, 7 May 2024 10:35:45 +0200 Subject: [PATCH 08/14] feat: add dot notation to Card component --- src/components/card/card.stories.tsx | 18 +++++++++--------- src/components/card/index.ts | 13 ++++++++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index c5fbd29..337d813 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -1,10 +1,10 @@ import type { Meta, StoryObj } from "@storybook/react"; +import Card from "."; import { Alert, GasOutline } from "../../../public/icons"; import { Badge } from "../badge/badge"; import { Cta } from "../cta"; import { Text } from "../text"; import { Title } from "../title"; -import { Card, CardFooter, CardContent, CardHeader } from "./card"; const meta: Meta = {}; @@ -13,13 +13,13 @@ type Story = StoryObj; export const Template: Story = { render: () => ( - +
A rischio sospensione
- +
@@ -31,8 +31,8 @@ export const Template: Story = { Pizza Risorgimento 3, Amandola (FM)
- - + +
@@ -61,10 +61,10 @@ export const Template: Story = {
- - + + Monitora e gestisci - -
+ + ), }; diff --git a/src/components/card/index.ts b/src/components/card/index.ts index 738731b..c968961 100644 --- a/src/components/card/index.ts +++ b/src/components/card/index.ts @@ -1 +1,12 @@ -export { Card } from "./card"; +import { Card, CardHeader, CardContent, CardFooter } from "./card"; + +const CardObject = { + Root: Card, + Header: CardHeader, + Content: CardContent, + Footer: CardFooter, +}; + +export { Card, CardHeader, CardContent, CardFooter }; + +export default CardObject; From 515cb73f0ae66685cbdf632c20dc67dd284549cf Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Tue, 7 May 2024 17:24:39 +0200 Subject: [PATCH 09/14] fix: rename files --- public/icons/gasOutline.tsx | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 public/icons/gasOutline.tsx diff --git a/public/icons/gasOutline.tsx b/public/icons/gasOutline.tsx deleted file mode 100644 index 6121e9b..0000000 --- a/public/icons/gasOutline.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import * as React from "react"; -import { SVGProps } from "react"; - -export const GasOutline = (props: SVGProps) => ( - - - - -); From 4be34e1b1589704e373bb2e51979775b7aac2ee1 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Wed, 8 May 2024 15:30:04 +0200 Subject: [PATCH 10/14] fix: adjust card spacings with theme --- src/components/card/card.stories.tsx | 18 +++++++++--------- src/components/card/styles.ts | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 337d813..585acb4 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -15,14 +15,14 @@ export const Template: Story = { render: () => (
- + A rischio sospensione
-
-
- +
+
+ Gas @@ -33,19 +33,19 @@ export const Template: Story = {
-
- +
+ Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo.
- + Per questa fornitura pagherai - + 65,46 € -
+
57 diff --git a/src/components/card/styles.ts b/src/components/card/styles.ts index 74f5e7a..031ad9c 100644 --- a/src/components/card/styles.ts +++ b/src/components/card/styles.ts @@ -1,5 +1,5 @@ import { cva } from "class-variance-authority"; -const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-4"); +const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-xs"); export { cardStyles }; From 8073041d8a25e04976ec7c139b7878d18e4477d5 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Wed, 8 May 2024 17:04:59 +0200 Subject: [PATCH 11/14] feat: set different styles for every part of the card --- src/components/card/card.stories.tsx | 20 +++++++++----------- src/components/card/card.tsx | 25 +++++++++++++++++++++---- src/components/card/styles.ts | 5 ++++- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 585acb4..d7ff1ab 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -19,18 +19,16 @@ export const Template: Story = { A rischio sospensione
- -
-
- - - Gas - -
- - Pizza Risorgimento 3, Amandola (FM) + +
+ + + Gas
+ + Pizza Risorgimento 3, Amandola (FM) +
@@ -63,7 +61,7 @@ export const Template: Story = {
- Monitora e gestisci + Monitora e gestisci ), diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx index ee559e4..84ef4db 100644 --- a/src/components/card/card.tsx +++ b/src/components/card/card.tsx @@ -1,7 +1,12 @@ import classNames from "classnames"; import { forwardRef } from "react"; import { CardProps } from "./types"; -import { cardStyles } from "./styles"; +import { + cardContentStyles, + cardFooterStyles, + cardHeaderStyles, + cardStyles, +} from "./styles"; const Card = forwardRef( ({ className, children, ...rest }, ref) => { @@ -22,7 +27,11 @@ Card.displayName = "Card"; const CardHeader = forwardRef( ({ className, children, ...rest }, ref) => { return ( -
+
{children}
); @@ -34,7 +43,11 @@ CardHeader.displayName = "CardHeader"; const CardContent = forwardRef( ({ className, children, ...rest }, ref) => { return ( -
+
{children}
); @@ -46,7 +59,11 @@ CardContent.displayName = "CardContent"; const CardFooter = forwardRef( ({ className, children, ...rest }, ref) => { return ( -
+
{children}
); diff --git a/src/components/card/styles.ts b/src/components/card/styles.ts index 031ad9c..6858021 100644 --- a/src/components/card/styles.ts +++ b/src/components/card/styles.ts @@ -1,5 +1,8 @@ import { cva } from "class-variance-authority"; const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-xs"); +const cardHeaderStyles = cva("border-b b-black pb-base"); +const cardContentStyles = cva("pb-2xs"); +const cardFooterStyles = cva("border-t b-black pr-xxs"); -export { cardStyles }; +export { cardStyles, cardHeaderStyles, cardContentStyles, cardFooterStyles }; From bf14d3b968e4651f8f269e21e905dac225fe07c6 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Wed, 8 May 2024 17:23:53 +0200 Subject: [PATCH 12/14] feat: add supply variant type --- src/components/card/card.stories.tsx | 22 +++++++++++++++++----- src/components/card/card.tsx | 4 ++-- src/components/card/styles.ts | 9 ++++++++- src/components/title/title.stories.tsx | 2 +- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index d7ff1ab..5089eae 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -6,14 +6,26 @@ import { Cta } from "../cta"; import { Text } from "../text"; import { Title } from "../title"; -const meta: Meta = {}; +type CardType = typeof Card.Root & + typeof Card.Header & + typeof Card.Content & + typeof Card.Footer; + +const meta: Meta = { + argTypes: { + supply: { + options: ["gas", "electricity"], + control: { type: "select" }, + }, + }, +}; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const Template: Story = { - render: () => ( - + render: (args) => ( +
A rischio sospensione @@ -23,7 +35,7 @@ export const Template: Story = {
- Gas + {args.supply === "gas" ? "Gas" : "Luce"}
diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx index 84ef4db..5d77cc7 100644 --- a/src/components/card/card.tsx +++ b/src/components/card/card.tsx @@ -9,11 +9,11 @@ import { } from "./styles"; const Card = forwardRef( - ({ className, children, ...rest }, ref) => { + ({ supply, className, children, ...rest }, ref) => { return (
{children} diff --git a/src/components/card/styles.ts b/src/components/card/styles.ts index 6858021..3b01dd0 100644 --- a/src/components/card/styles.ts +++ b/src/components/card/styles.ts @@ -1,6 +1,13 @@ import { cva } from "class-variance-authority"; -const cardStyles = cva("w-[280px] h-[280px] bg-cyan pl-xs"); +const cardStyles = cva("w-[280px] h-[280px] pl-xs", { + variants: { + supply: { + gas: "bg-cyan", + electricity: "bg-yellow", + }, + }, +}); const cardHeaderStyles = cva("border-b b-black pb-base"); const cardContentStyles = cva("pb-2xs"); const cardFooterStyles = cva("border-t b-black pr-xxs"); diff --git a/src/components/title/title.stories.tsx b/src/components/title/title.stories.tsx index 00761a5..806e3c6 100644 --- a/src/components/title/title.stories.tsx +++ b/src/components/title/title.stories.tsx @@ -17,6 +17,6 @@ const meta: Meta = { export default meta; type Story = StoryObj; -export const Primary: Story = { +export const Template: Story = { render: (args) => Heading, }; From a48a918b7be0f02c898a2661713249f939058479 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Wed, 8 May 2024 17:33:15 +0200 Subject: [PATCH 13/14] feat: add electricity icon --- public/icons/electricity-outline.tsx | 12 +++ public/icons/index.ts | 1 + src/components/card/card.stories.tsx | 117 +++++++++++++++------------ 3 files changed, 80 insertions(+), 50 deletions(-) create mode 100644 public/icons/electricity-outline.tsx diff --git a/public/icons/electricity-outline.tsx b/public/icons/electricity-outline.tsx new file mode 100644 index 0000000..0bf3626 --- /dev/null +++ b/public/icons/electricity-outline.tsx @@ -0,0 +1,12 @@ +import * as React from "react"; +import { SVGProps } from "react"; + +export const ElectricityOutline = (props: SVGProps) => ( + + + +); diff --git a/public/icons/index.ts b/public/icons/index.ts index e8ab54f..62e50fb 100644 --- a/public/icons/index.ts +++ b/public/icons/index.ts @@ -1,3 +1,4 @@ export { Alert } from "./alert"; export { ArrowRight } from "./arrow-right"; +export { ElectricityOutline } from "./electricity-outline"; export { GasOutline } from "./gas-outline"; diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index 5089eae..e0fab7f 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; import Card from "."; -import { Alert, GasOutline } from "../../../public/icons"; +import { Alert, ElectricityOutline, GasOutline } from "../../../public/icons"; import { Badge } from "../badge/badge"; import { Cta } from "../cta"; import { Text } from "../text"; @@ -18,63 +18,80 @@ const meta: Meta = { control: { type: "select" }, }, }, + args: { + supply: "gas", + }, }; export default meta; type Story = StoryObj; export const Template: Story = { - render: (args) => ( - -
- - A rischio sospensione - -
- -
- - - {args.supply === "gas" ? "Gas" : "Luce"} - -
- - Pizza Risorgimento 3, Amandola (FM) - -
- -
- - - Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo. - + render: (args) => { + const isGasSupply = args.supply === "gas"; + const supplyText = isGasSupply ? "Gas" : "Luce"; + const supplyIcon = isGasSupply ? ( + + ) : ( + + ); + + return ( + +
+ + A rischio sospensione +
- - Per questa fornitura pagherai - - - 65,46 € - -
- - 57 - -
- - ,99 € - - - al mese, + +
+ {supplyIcon} + + {supplyText} - - per 12 mesi. +
+ + Pizza Risorgimento 3, Amandola (FM) + +
+ +
+ + + Dobbiamo chiederti di compilare un modulo. Entra per scaricarlo.
-
- - - Monitora e gestisci - - - ), + + Per questa fornitura pagherai + + + 65,46 € + +
+ + 57 + +
+ + ,99 € + + + al mese, + + + per 12 mesi. + +
+
+ + + Monitora e gestisci + + + ); + }, }; From 926947c6b958f1fb580a3e4eeb1e0afed148b918 Mon Sep 17 00:00:00 2001 From: Fedevvi Date: Thu, 9 May 2024 15:20:40 +0200 Subject: [PATCH 14/14] fix: minor --- src/components/card/card.stories.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/card/card.stories.tsx b/src/components/card/card.stories.tsx index e0fab7f..872eb26 100644 --- a/src/components/card/card.stories.tsx +++ b/src/components/card/card.stories.tsx @@ -51,7 +51,7 @@ export const Template: Story = {
- Pizza Risorgimento 3, Amandola (FM) + Piazza Risorgimento 3, Amandola (FM) @@ -64,11 +64,7 @@ export const Template: Story = { Per questa fornitura pagherai - + 65,46 €