From 279bf25a815f3906c3d46132b6fbc18d8fc76ade Mon Sep 17 00:00:00 2001 From: "vivid-github[bot]" <129557859+vivid-github[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:46:35 +0000 Subject: [PATCH 1/3] Add new components --- components/Card.module.css | 66 ++++++++++++++++++++ components/Card.tsx | 122 +++++++++++++++++++++++++++++++++++++ components/CardPage.tsx | 11 ++++ components/sun.svg | 4 ++ components/sunImage.svg | 4 ++ 5 files changed, 207 insertions(+) create mode 100644 components/Card.module.css create mode 100644 components/Card.tsx create mode 100644 components/CardPage.tsx create mode 100644 components/sun.svg create mode 100644 components/sunImage.svg diff --git a/components/Card.module.css b/components/Card.module.css new file mode 100644 index 00000000..d7ee0958 --- /dev/null +++ b/components/Card.module.css @@ -0,0 +1,66 @@ +.title { + font-size: 37px; + font-weight: 500; +} +.sun { + width: 50px; + height: 50px; +} +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 25px; + width: 100%; + height: 93px; +} +.bodyText { + width: 100%; + font-size: 16px; + font-weight: 400; + letter-spacing: 0.5px; + line-height: 23px; +} +.body { + display: flex; + flex-direction: column; + align-items: flex-start; + height: fit-content; + padding: 25px; + width: 100%; +} +.theme { + font-size: 15px; + font-weight: 500; +} +.buttonText { + font-size: 15px; + font-weight: 500; +} +.button { + overflow: hidden; + display: flex; + align-items: center; + width: fit-content; + height: fit-content; + padding: 10px; + border-radius: 5px; +} +.footer { + overflow: hidden; + display: flex; + justify-content: space-between; + align-items: center; + height: fit-content; + padding: 25px; + width: 100%; +} +.cardComponent { + overflow: hidden; + display: flex; + flex-direction: column; + align-items: flex-start; + height: fit-content; + border-radius: 20px; + width: 360px; +} diff --git a/components/Card.tsx b/components/Card.tsx new file mode 100644 index 00000000..d0df248b --- /dev/null +++ b/components/Card.tsx @@ -0,0 +1,122 @@ +import styles from "./Card.module.css"; +import sunImage from "./sunImage.svg"; +import sun from "./sun.svg"; +export const Card = ({ + override, + mode, +}: { + override?: React.CSSProperties; + mode: string; +}) => { + const titleMode = + mode === "Dark" + ? { + color: "rgb(255, 255, 255)", + } + : { + color: "rgb(0, 0, 0)", + }; + const bodyTextMode = + mode === "Dark" + ? { + color: "rgb(255, 255, 255)", + } + : { + color: "rgb(0, 0, 0)", + }; + const themeMode = + mode === "Dark" + ? { + color: "rgb(255, 255, 255)", + } + : { + color: "rgb(0, 0, 0)", + }; + const buttonTextMode = + mode === "Dark" + ? { + color: "rgb(0, 0, 0)", + } + : { + color: "rgb(255, 255, 255)", + }; + const buttonMode = + mode === "Dark" + ? { + backgroundColor: "rgb(255, 255, 255)", + } + : { + backgroundColor: "rgb(7, 14, 19)", + }; + const cardMode = + mode === "Dark" + ? { + backgroundColor: "rgb(7, 14, 19)", + } + : { + backgroundColor: "rgb(255, 255, 255)", + }; + let sunSrc; + if (mode === "Light") { + sunSrc = sunImage; + } else { + sunSrc = sun; + } + return ( +
+
+

+ Trends +

+ +
+
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididun... +

+
+
+

+ Theme +

+
+

+ Click me! +

+
+
+
+ ); +}; diff --git a/components/CardPage.tsx b/components/CardPage.tsx new file mode 100644 index 00000000..8c99b42b --- /dev/null +++ b/components/CardPage.tsx @@ -0,0 +1,11 @@ +import { Card } from "./Card"; +export const CardPage = ({ override }: { override?: React.CSSProperties }) => { + return ( + + ); +}; diff --git a/components/sun.svg b/components/sun.svg new file mode 100644 index 00000000..3b44e256 --- /dev/null +++ b/components/sun.svg @@ -0,0 +1,4 @@ + + + + diff --git a/components/sunImage.svg b/components/sunImage.svg new file mode 100644 index 00000000..3e84712e --- /dev/null +++ b/components/sunImage.svg @@ -0,0 +1,4 @@ + + + + From 2f1e1b132cf9bdd1e471852feb6af077a601a617 Mon Sep 17 00:00:00 2001 From: "vivid-github[bot]" <129557859+vivid-github[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:46:57 +0000 Subject: [PATCH 2/3] Improve naming of CSS class names --- components/Card.module.css | 22 ++++----- components/Card.tsx | 94 +++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/components/Card.module.css b/components/Card.module.css index d7ee0958..c9207727 100644 --- a/components/Card.module.css +++ b/components/Card.module.css @@ -1,12 +1,12 @@ -.title { +.cardTitle{ font-size: 37px; font-weight: 500; } -.sun { +.sunImage{ width: 50px; height: 50px; } -.header { +.cardHeader{ display: flex; justify-content: space-between; align-items: center; @@ -14,14 +14,14 @@ width: 100%; height: 93px; } -.bodyText { +.cardBodyText{ width: 100%; font-size: 16px; font-weight: 400; letter-spacing: 0.5px; line-height: 23px; } -.body { +.cardBody{ display: flex; flex-direction: column; align-items: flex-start; @@ -29,15 +29,15 @@ padding: 25px; width: 100%; } -.theme { +.cardTheme{ font-size: 15px; font-weight: 500; } -.buttonText { +.buttonText{ font-size: 15px; font-weight: 500; } -.button { +.cardButton{ overflow: hidden; display: flex; align-items: center; @@ -46,7 +46,7 @@ padding: 10px; border-radius: 5px; } -.footer { +.cardFooter{ overflow: hidden; display: flex; justify-content: space-between; @@ -55,7 +55,7 @@ padding: 25px; width: 100%; } -.cardComponent { +.cardComponent{ overflow: hidden; display: flex; flex-direction: column; @@ -63,4 +63,4 @@ height: fit-content; border-radius: 20px; width: 360px; -} +} \ No newline at end of file diff --git a/components/Card.tsx b/components/Card.tsx index d0df248b..152558d2 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -64,59 +64,59 @@ export const Card = ({ } return (
-
-

- Trends -

- -
-
-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididun... -

-
-
+ className={styles.cardComponent} + style={{ + ...cardMode, + ...override, + }} + > +
+

+ Trends +

+ +
+
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididun... +

+
+
+

+ Theme +

+

- Theme + Click me!

-
-

- Click me! -

-
+
); }; From 820aa443a4d729413feb59e7667500c08f35045a Mon Sep 17 00:00:00 2001 From: "vivid-github[bot]" <129557859+vivid-github[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:47:04 +0000 Subject: [PATCH 3/3] Modularize generated code --- components/Card.tsx | 115 +++++++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 49 deletions(-) diff --git a/components/Card.tsx b/components/Card.tsx index 152558d2..2c7c81ae 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -1,6 +1,7 @@ import styles from "./Card.module.css"; import sunImage from "./sunImage.svg"; import sun from "./sun.svg"; + export const Card = ({ override, mode, @@ -64,59 +65,75 @@ export const Card = ({ } return (
-
-

- Trends -

- + className={styles.cardComponent} + style={{ + ...cardMode, + ...override, + }} + > + + +
-
-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididun... -

-
-
+ ); +}; + +const Trends = ({ titleMode, sunSrc }: any) => ( +
+

+ Trends +

+ +
+); + +const CardBody = ({ bodyTextMode }: any) => ( +
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididun... +

+
+); + +const CardFooter = ({ themeMode, buttonMode, buttonTextMode }: any) => ( +
+

+ Theme +

+

- Theme + Click me!

-
-

- Click me! -

-
-
- ); -}; +
+);