From 461aab100f7a275add95e99ef52d3b375bffc182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=98=81=EC=95=A0?= Date: Thu, 13 Mar 2025 12:07:28 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feature:=20helperlabel=20=EB=A7=88=ED=81=AC?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/HelperLabel/HelperLabel.tsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/components/common/HelperLabel/HelperLabel.tsx diff --git a/src/components/common/HelperLabel/HelperLabel.tsx b/src/components/common/HelperLabel/HelperLabel.tsx new file mode 100644 index 0000000..6d30763 --- /dev/null +++ b/src/components/common/HelperLabel/HelperLabel.tsx @@ -0,0 +1,38 @@ +import * as React from 'react' +import { cn } from '@/lib/utils' +import { cva, type VariantProps } from 'class-variance-authority' + +const helperLabelVariants = cva('', { + variants: { + variant: { + error: 'text-error', + success: 'text-success', + default: 'text-alternative', + }, + size: { + default: 'typo-caption2', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, +}) + +interface HelperLabelProps + extends React.HTMLAttributes, + VariantProps {} + +const HelperLabel = ({ className, variant, children, ...props }: HelperLabelProps) => { + return ( +

+ {children} +

+ ) +} + +export { HelperLabel } From bbabaeae26e1316a6e18c20e21d0038bd613c4ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=98=81=EC=95=A0?= Date: Thu, 13 Mar 2025 12:28:32 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feature:=20label=20=EB=A7=88=ED=81=AC?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Label/Label.tsx | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/components/common/Label/Label.tsx diff --git a/src/components/common/Label/Label.tsx b/src/components/common/Label/Label.tsx new file mode 100644 index 0000000..881d3af --- /dev/null +++ b/src/components/common/Label/Label.tsx @@ -0,0 +1,33 @@ +import * as React from 'react' +import { cn } from '@/lib/utils' +import { cva, VariantProps } from 'class-variance-authority' +import * as LabelPrimitive from '@radix-ui/react-label' + +const LabelVariants = cva('', { + variants: { + variant: { + caption1: 'typo-caption1', + button1: 'typo-button1', + button2: 'typo-button2', + }, + }, + defaultVariants: { + variant: 'caption1', + }, +}) + +interface LabelProps + extends React.LabelHTMLAttributes, + VariantProps {} + +function Label({ className, variant, ...props }: LabelProps) { + return ( + + ) +} + +export { Label } From 6d7694ff70a905e0cd6f870e1cf1c80ed2cd96fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=98=81=EC=95=A0?= Date: Thu, 13 Mar 2025 16:46:09 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feature:=20input=20=EB=A7=88=ED=81=AC?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Input/Input.tsx | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/components/common/Input/Input.tsx diff --git a/src/components/common/Input/Input.tsx b/src/components/common/Input/Input.tsx new file mode 100644 index 0000000..e7222f5 --- /dev/null +++ b/src/components/common/Input/Input.tsx @@ -0,0 +1,53 @@ +import * as React from 'react' +import { cn } from '@/lib/utils' +import { cva, VariantProps } from 'class-variance-authority' + +const InputVariants = cva( + 'typo-body3 border p-4 rounded-sm outline-none placeholder-assistive text-secondary', + { + variants: { + variant: { + default: 'border-assistive', + focused: 'border-secondary', + error: 'border-error', + disabled: 'border-assistive bg-disabled-fill cursor-not-allowed text-disabled', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +interface InputProps + extends React.InputHTMLAttributes, + VariantProps { + error?: boolean +} + +function Input({ className, variant, type, disabled, error, ...props }: InputProps) { + const [isFocused, setIsFocused] = React.useState(false) + + let currentState = variant + if (disabled) { + currentState = 'disabled' + } else if (isFocused) { + currentState = 'focused' + } else if (error) { + currentState = 'error' + } + + return ( + setIsFocused(true)} + onBlur={() => setIsFocused(false)} + {...props} + /> + ) +} + +export { Input } From 866351e627625991c2dfdb7ab4e744efa7d0152e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=98=81=EC=95=A0?= Date: Thu, 13 Mar 2025 18:42:51 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feature:=20textarea=20=EB=A7=88=ED=81=AC?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Textarea/Textarea.tsx | 51 +++++++++++++++++++++ src/styles/globals.css | 14 ++++++ 2 files changed, 65 insertions(+) create mode 100644 src/components/common/Textarea/Textarea.tsx diff --git a/src/components/common/Textarea/Textarea.tsx b/src/components/common/Textarea/Textarea.tsx new file mode 100644 index 0000000..a666b49 --- /dev/null +++ b/src/components/common/Textarea/Textarea.tsx @@ -0,0 +1,51 @@ +import * as React from 'react' +import { cn } from '@/lib/utils' +import { cva, VariantProps } from 'class-variance-authority' + +const TextareaVariants = cva( + 'typo-body3 border p-4 rounded-sm outline-none placeholder-assistive text-secondary resize-none custom-scrollbar', + { + variants: { + variant: { + default: 'border-assistive', + focused: 'border-secondary', + error: 'border-error', + disabled: 'border-assistive bg-disabled-fill cursor-not-allowed text-disabled', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +interface TextareaProps + extends React.TextareaHTMLAttributes, + VariantProps { + error?: boolean +} + +const Textarea = ({ className, variant, disabled, error, ...props }: TextareaProps) => { + const [isFocused, setIsFocused] = React.useState(false) + + let currentState = variant + if (disabled) { + currentState = 'disabled' + } else if (isFocused) { + currentState = 'focused' + } else if (error) { + currentState = 'error' + } + return ( +