forked from baron/baron-sso
button badge input card 공용화
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
26
common/ui/badge.ts
Normal file
26
common/ui/badge.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export const commonBadgeBaseClass =
|
||||
"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";
|
||||
|
||||
export const commonBadgeVariantClasses = {
|
||||
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",
|
||||
info: "border-transparent bg-blue-500 text-white hover:bg-blue-500/90",
|
||||
} as const;
|
||||
|
||||
export type CommonBadgeVariant = keyof typeof commonBadgeVariantClasses;
|
||||
|
||||
export function getCommonBadgeClasses({
|
||||
variant = "default",
|
||||
}: {
|
||||
variant?: CommonBadgeVariant;
|
||||
}) {
|
||||
return [commonBadgeBaseClass, commonBadgeVariantClasses[variant]].join(" ");
|
||||
}
|
||||
37
common/ui/button.ts
Normal file
37
common/ui/button.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
export const commonButtonBaseClass =
|
||||
"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";
|
||||
|
||||
export const commonButtonVariantClasses = {
|
||||
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",
|
||||
} as const;
|
||||
|
||||
export const commonButtonSizeClasses = {
|
||||
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",
|
||||
} as const;
|
||||
|
||||
export type CommonButtonVariant = keyof typeof commonButtonVariantClasses;
|
||||
export type CommonButtonSize = keyof typeof commonButtonSizeClasses;
|
||||
|
||||
export function getCommonButtonClasses({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
}: {
|
||||
variant?: CommonButtonVariant;
|
||||
size?: CommonButtonSize;
|
||||
}) {
|
||||
return [
|
||||
commonButtonBaseClass,
|
||||
commonButtonVariantClasses[variant],
|
||||
commonButtonSizeClasses[size],
|
||||
].join(" ");
|
||||
}
|
||||
7
common/ui/card.ts
Normal file
7
common/ui/card.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const commonCardClass =
|
||||
"rounded-2xl border border-border bg-card/90 text-card-foreground shadow-card";
|
||||
export const commonCardHeaderClass = "flex flex-col space-y-1.5 p-6";
|
||||
export const commonCardTitleClass = "text-lg font-semibold leading-none";
|
||||
export const commonCardDescriptionClass = "text-sm text-muted-foreground";
|
||||
export const commonCardContentClass = "p-6 pt-0";
|
||||
export const commonCardFooterClass = "flex items-center p-6 pt-0";
|
||||
2
common/ui/input.ts
Normal file
2
common/ui/input.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const commonInputClass =
|
||||
"flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";
|
||||
Reference in New Issue
Block a user