From 5149fdc246455703b60f2fd73cd62abe72ec1c48 Mon Sep 17 00:00:00 2001 From: kyy Date: Mon, 11 May 2026 17:38:07 +0900 Subject: [PATCH] =?UTF-8?q?button=20badge=20input=20card=20=EA=B3=B5?= =?UTF-8?q?=EC=9A=A9=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminfront/src/components/ui/badge.tsx | 43 ++++++----------------- adminfront/src/components/ui/button.tsx | 45 ++++++------------------- adminfront/src/components/ui/card.tsx | 29 ++++++++-------- adminfront/src/components/ui/input.tsx | 3 +- common/ui/.gitkeep | 1 - common/ui/badge.ts | 26 ++++++++++++++ common/ui/button.ts | 37 ++++++++++++++++++++ common/ui/card.ts | 7 ++++ common/ui/input.ts | 2 ++ devfront/src/components/ui/badge.tsx | 44 ++++++------------------ devfront/src/components/ui/button.tsx | 45 ++++++------------------- devfront/src/components/ui/card.tsx | 29 ++++++++-------- devfront/src/components/ui/input.tsx | 3 +- orgfront/src/components/ui/badge.tsx | 44 ++++++------------------ orgfront/src/components/ui/button.tsx | 45 ++++++------------------- orgfront/src/components/ui/card.tsx | 29 ++++++++-------- orgfront/src/components/ui/input.tsx | 3 +- 17 files changed, 183 insertions(+), 252 deletions(-) delete mode 100644 common/ui/.gitkeep create mode 100644 common/ui/badge.ts create mode 100644 common/ui/button.ts create mode 100644 common/ui/card.ts create mode 100644 common/ui/input.ts diff --git a/adminfront/src/components/ui/badge.tsx b/adminfront/src/components/ui/badge.tsx index 8ef586fd..98e1ad01 100644 --- a/adminfront/src/components/ui/badge.tsx +++ b/adminfront/src/components/ui/badge.tsx @@ -1,38 +1,17 @@ -import { type VariantProps, cva } from "class-variance-authority"; import type * as React from "react"; +import { + type CommonBadgeVariant, + getCommonBadgeClasses, +} from "../../../../common/ui/badge"; import { cn } from "../../lib/utils"; -const badgeVariants = cva( - "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", - { - variants: { - variant: { - default: - "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/90", - secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", - outline: "text-foreground", - muted: "border-border bg-secondary/60 text-muted-foreground", - success: - "border-transparent bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300", - warning: - "border-transparent bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-200", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - export interface BadgeProps - extends React.HTMLAttributes, - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
- ); + extends React.HTMLAttributes { + variant?: CommonBadgeVariant; } -export { Badge, badgeVariants }; +function Badge({ className, variant, ...props }: BadgeProps) { + return
; +} + +export { Badge }; diff --git a/adminfront/src/components/ui/button.tsx b/adminfront/src/components/ui/button.tsx index ee1a84b4..1066cf1b 100644 --- a/adminfront/src/components/ui/button.tsx +++ b/adminfront/src/components/ui/button.tsx @@ -1,41 +1,16 @@ import { Slot } from "@radix-ui/react-slot"; -import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; +import { + type CommonButtonSize, + type CommonButtonVariant, + getCommonButtonClasses, +} from "../../../../common/ui/button"; import { cn } from "../../lib/utils"; -const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background", - { - variants: { - variant: { - default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - ghost: "hover:bg-accent hover:text-accent-foreground", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - muted: "bg-muted text-muted-foreground hover:bg-muted/80", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-6 text-base", - icon: "h-10 w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { + extends React.ButtonHTMLAttributes { + variant?: CommonButtonVariant; + size?: CommonButtonSize; asChild?: boolean; } @@ -44,7 +19,7 @@ const Button = React.forwardRef( const Comp = asChild ? Slot : "button"; return ( @@ -53,4 +28,4 @@ const Button = React.forwardRef( ); Button.displayName = "Button"; -export { Button, buttonVariants }; +export { Button }; diff --git a/adminfront/src/components/ui/card.tsx b/adminfront/src/components/ui/card.tsx index 7048cb12..a96a29b5 100644 --- a/adminfront/src/components/ui/card.tsx +++ b/adminfront/src/components/ui/card.tsx @@ -1,13 +1,18 @@ import type * as React from "react"; +import { + commonCardClass, + commonCardContentClass, + commonCardDescriptionClass, + commonCardFooterClass, + commonCardHeaderClass, + commonCardTitleClass, +} from "../../../../common/ui/card"; import { cn } from "../../lib/utils"; function Card({ className, ...props }: React.HTMLAttributes) { return (
); @@ -18,10 +23,7 @@ function CardHeader({ ...props }: React.HTMLAttributes) { return ( -
+
); } @@ -30,10 +32,7 @@ function CardTitle({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -42,7 +41,7 @@ function CardDescription({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -50,7 +49,7 @@ function CardContent({ className, ...props }: React.HTMLAttributes) { - return

; + return
; } function CardFooter({ @@ -58,7 +57,7 @@ function CardFooter({ ...props }: React.HTMLAttributes) { return ( -
+
); } diff --git a/adminfront/src/components/ui/input.tsx b/adminfront/src/components/ui/input.tsx index 41955477..c4dc7a83 100644 --- a/adminfront/src/components/ui/input.tsx +++ b/adminfront/src/components/ui/input.tsx @@ -1,4 +1,5 @@ import * as React from "react"; +import { commonInputClass } from "../../../../common/ui/input"; import { cn } from "../../lib/utils"; export interface InputProps @@ -10,7 +11,7 @@ const Input = React.forwardRef( , - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
- ); + extends React.HTMLAttributes { + variant?: CommonBadgeVariant; } -export { Badge, badgeVariants }; +function Badge({ className, variant, ...props }: BadgeProps) { + return
; +} + +export { Badge }; diff --git a/devfront/src/components/ui/button.tsx b/devfront/src/components/ui/button.tsx index ee1a84b4..1066cf1b 100644 --- a/devfront/src/components/ui/button.tsx +++ b/devfront/src/components/ui/button.tsx @@ -1,41 +1,16 @@ import { Slot } from "@radix-ui/react-slot"; -import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; +import { + type CommonButtonSize, + type CommonButtonVariant, + getCommonButtonClasses, +} from "../../../../common/ui/button"; import { cn } from "../../lib/utils"; -const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background", - { - variants: { - variant: { - default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - ghost: "hover:bg-accent hover:text-accent-foreground", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - muted: "bg-muted text-muted-foreground hover:bg-muted/80", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-6 text-base", - icon: "h-10 w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { + extends React.ButtonHTMLAttributes { + variant?: CommonButtonVariant; + size?: CommonButtonSize; asChild?: boolean; } @@ -44,7 +19,7 @@ const Button = React.forwardRef( const Comp = asChild ? Slot : "button"; return ( @@ -53,4 +28,4 @@ const Button = React.forwardRef( ); Button.displayName = "Button"; -export { Button, buttonVariants }; +export { Button }; diff --git a/devfront/src/components/ui/card.tsx b/devfront/src/components/ui/card.tsx index 7048cb12..a96a29b5 100644 --- a/devfront/src/components/ui/card.tsx +++ b/devfront/src/components/ui/card.tsx @@ -1,13 +1,18 @@ import type * as React from "react"; +import { + commonCardClass, + commonCardContentClass, + commonCardDescriptionClass, + commonCardFooterClass, + commonCardHeaderClass, + commonCardTitleClass, +} from "../../../../common/ui/card"; import { cn } from "../../lib/utils"; function Card({ className, ...props }: React.HTMLAttributes) { return (
); @@ -18,10 +23,7 @@ function CardHeader({ ...props }: React.HTMLAttributes) { return ( -
+
); } @@ -30,10 +32,7 @@ function CardTitle({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -42,7 +41,7 @@ function CardDescription({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -50,7 +49,7 @@ function CardContent({ className, ...props }: React.HTMLAttributes) { - return

; + return
; } function CardFooter({ @@ -58,7 +57,7 @@ function CardFooter({ ...props }: React.HTMLAttributes) { return ( -
+
); } diff --git a/devfront/src/components/ui/input.tsx b/devfront/src/components/ui/input.tsx index 41955477..c4dc7a83 100644 --- a/devfront/src/components/ui/input.tsx +++ b/devfront/src/components/ui/input.tsx @@ -1,4 +1,5 @@ import * as React from "react"; +import { commonInputClass } from "../../../../common/ui/input"; import { cn } from "../../lib/utils"; export interface InputProps @@ -10,7 +11,7 @@ const Input = React.forwardRef( , - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
- ); + extends React.HTMLAttributes { + variant?: CommonBadgeVariant; } -export { Badge, badgeVariants }; +function Badge({ className, variant, ...props }: BadgeProps) { + return
; +} + +export { Badge }; diff --git a/orgfront/src/components/ui/button.tsx b/orgfront/src/components/ui/button.tsx index ee1a84b4..1066cf1b 100644 --- a/orgfront/src/components/ui/button.tsx +++ b/orgfront/src/components/ui/button.tsx @@ -1,41 +1,16 @@ import { Slot } from "@radix-ui/react-slot"; -import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; +import { + type CommonButtonSize, + type CommonButtonVariant, + getCommonButtonClasses, +} from "../../../../common/ui/button"; import { cn } from "../../lib/utils"; -const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background", - { - variants: { - variant: { - default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - ghost: "hover:bg-accent hover:text-accent-foreground", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - muted: "bg-muted text-muted-foreground hover:bg-muted/80", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-6 text-base", - icon: "h-10 w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { + extends React.ButtonHTMLAttributes { + variant?: CommonButtonVariant; + size?: CommonButtonSize; asChild?: boolean; } @@ -44,7 +19,7 @@ const Button = React.forwardRef( const Comp = asChild ? Slot : "button"; return ( @@ -53,4 +28,4 @@ const Button = React.forwardRef( ); Button.displayName = "Button"; -export { Button, buttonVariants }; +export { Button }; diff --git a/orgfront/src/components/ui/card.tsx b/orgfront/src/components/ui/card.tsx index 7048cb12..a96a29b5 100644 --- a/orgfront/src/components/ui/card.tsx +++ b/orgfront/src/components/ui/card.tsx @@ -1,13 +1,18 @@ import type * as React from "react"; +import { + commonCardClass, + commonCardContentClass, + commonCardDescriptionClass, + commonCardFooterClass, + commonCardHeaderClass, + commonCardTitleClass, +} from "../../../../common/ui/card"; import { cn } from "../../lib/utils"; function Card({ className, ...props }: React.HTMLAttributes) { return (
); @@ -18,10 +23,7 @@ function CardHeader({ ...props }: React.HTMLAttributes) { return ( -
+
); } @@ -30,10 +32,7 @@ function CardTitle({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -42,7 +41,7 @@ function CardDescription({ ...props }: React.HTMLAttributes) { return ( -

+

); } @@ -50,7 +49,7 @@ function CardContent({ className, ...props }: React.HTMLAttributes) { - return

; + return
; } function CardFooter({ @@ -58,7 +57,7 @@ function CardFooter({ ...props }: React.HTMLAttributes) { return ( -
+
); } diff --git a/orgfront/src/components/ui/input.tsx b/orgfront/src/components/ui/input.tsx index 41955477..c4dc7a83 100644 --- a/orgfront/src/components/ui/input.tsx +++ b/orgfront/src/components/ui/input.tsx @@ -1,4 +1,5 @@ import * as React from "react"; +import { commonInputClass } from "../../../../common/ui/input"; import { cn } from "../../lib/utils"; export interface InputProps @@ -10,7 +11,7 @@ const Input = React.forwardRef(