From c8be9deee4caf2a83333333436ddc827ad0fbfcf Mon Sep 17 00:00:00 2001 From: yawn <69970183+yawn-c111@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:37:12 +0900 Subject: [PATCH 1/3] feat: added original button component --- pkgs/frontend/app/components/button.tsx | 35 ++++++ pkgs/frontend/app/routes/_index.tsx | 137 ++++++++++++------------ 2 files changed, 105 insertions(+), 67 deletions(-) create mode 100644 pkgs/frontend/app/components/button.tsx diff --git a/pkgs/frontend/app/components/button.tsx b/pkgs/frontend/app/components/button.tsx new file mode 100644 index 0000000..ec0e6c7 --- /dev/null +++ b/pkgs/frontend/app/components/button.tsx @@ -0,0 +1,35 @@ +import { + Button as ChakraButton, + ButtonProps as ChakraButtonProps, +} from "@chakra-ui/react"; + +interface ButtonProps extends Omit { + children: React.ReactNode; + width?: "full" | number; + size?: "sm" | "md" | "lg"; + backgroundColor?: string; + color?: string; +} + +export const Button = ({ + children, + width = "full", + size = "md", + backgroundColor, + color, + ...props +}: ButtonProps) => { + return ( + + {children} + + ); +}; + +export default Button; diff --git a/pkgs/frontend/app/routes/_index.tsx b/pkgs/frontend/app/routes/_index.tsx index 3e050f4..c8d067b 100644 --- a/pkgs/frontend/app/routes/_index.tsx +++ b/pkgs/frontend/app/routes/_index.tsx @@ -1,79 +1,82 @@ import { - Box, - Button, - Checkbox, - ClientOnly, - HStack, - Heading, - Progress, - RadioGroup, - Skeleton, - VStack, -} from "@chakra-ui/react" -import type { MetaFunction } from "@remix-run/node" -import { ColorModeToggle } from "../components/color-mode-toggle" + Box, + Checkbox, + ClientOnly, + HStack, + Heading, + Progress, + RadioGroup, + Skeleton, + VStack, +} from "@chakra-ui/react"; +import type { MetaFunction } from "@remix-run/node"; +import { ColorModeToggle } from "../components/color-mode-toggle"; +import { Button } from "~/components/button"; export const meta: MetaFunction = () => { - return [ - { title: "New Remix App" }, - { name: "description", content: "Welcome to Remix!" }, - ] -} + return [ + { title: "New Remix App" }, + { name: "description", content: "Welcome to Remix!" }, + ]; +}; export default function Index() { - return ( - - - chakra logo - - Welcome to Chakra UI v3 + Remix - + return ( + + + + chakra logo + + Welcome to Chakra UI v3 + Remix + - - - - - - - Checkbox - + + + + + + + Checkbox + - - - - - - - Radio - + + + + + + + Radio + - - - - - - Radio - - - + + + + + + Radio + + + - - - - - + + + + + - - - - - + + + + + - - }> - - - - - ) + + }> + + + + + ); } From fe7754e3b7cd0884ffa43f79991ba46e12e93ae3 Mon Sep 17 00:00:00 2001 From: yawn <69970183+yawn-c111@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:21:07 +0900 Subject: [PATCH 2/3] refactor: rename CommonButton --- .../components/{button.tsx => CommonButton.tsx} | 17 +++++++---------- pkgs/frontend/app/routes/_index.tsx | 7 ++++--- 2 files changed, 11 insertions(+), 13 deletions(-) rename pkgs/frontend/app/components/{button.tsx => CommonButton.tsx} (58%) diff --git a/pkgs/frontend/app/components/button.tsx b/pkgs/frontend/app/components/CommonButton.tsx similarity index 58% rename from pkgs/frontend/app/components/button.tsx rename to pkgs/frontend/app/components/CommonButton.tsx index ec0e6c7..bc1dc6d 100644 --- a/pkgs/frontend/app/components/button.tsx +++ b/pkgs/frontend/app/components/CommonButton.tsx @@ -1,9 +1,6 @@ -import { - Button as ChakraButton, - ButtonProps as ChakraButtonProps, -} from "@chakra-ui/react"; +import { Button, ButtonProps } from "@chakra-ui/react"; -interface ButtonProps extends Omit { +interface CommonButtonProps extends Omit { children: React.ReactNode; width?: "full" | number; size?: "sm" | "md" | "lg"; @@ -11,16 +8,16 @@ interface ButtonProps extends Omit { color?: string; } -export const Button = ({ +export const CommonButton = ({ children, width = "full", size = "md", backgroundColor, color, ...props -}: ButtonProps) => { +}: CommonButtonProps) => { return ( - {children} - + ); }; -export default Button; +export default CommonButton; diff --git a/pkgs/frontend/app/routes/_index.tsx b/pkgs/frontend/app/routes/_index.tsx index c8d067b..fef0165 100644 --- a/pkgs/frontend/app/routes/_index.tsx +++ b/pkgs/frontend/app/routes/_index.tsx @@ -1,5 +1,6 @@ import { Box, + Button, Checkbox, ClientOnly, HStack, @@ -11,7 +12,7 @@ import { } from "@chakra-ui/react"; import type { MetaFunction } from "@remix-run/node"; import { ColorModeToggle } from "../components/color-mode-toggle"; -import { Button } from "~/components/button"; +import { CommonButton } from "~/components/CommonButton"; export const meta: MetaFunction = () => { return [ @@ -23,9 +24,9 @@ export const meta: MetaFunction = () => { export default function Index() { return ( - + chakra logo From 8007d34d180c2057d18f708af3a702f9767d033c Mon Sep 17 00:00:00 2001 From: yawn <69970183+yawn-c111@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:21:52 +0900 Subject: [PATCH 3/3] refactor: update CommonButton import path --- pkgs/frontend/app/components/CommonButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/frontend/app/components/CommonButton.tsx b/pkgs/frontend/app/components/CommonButton.tsx index bc1dc6d..337cab6 100644 --- a/pkgs/frontend/app/components/CommonButton.tsx +++ b/pkgs/frontend/app/components/CommonButton.tsx @@ -1,4 +1,4 @@ -import { Button, ButtonProps } from "@chakra-ui/react"; +import { Button, ButtonProps } from "~/components/ui/button"; interface CommonButtonProps extends Omit { children: React.ReactNode;