File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 33import { Slot } from '@radix-ui/react-slot' ;
44import { type VariantProps , cva } from 'class-variance-authority' ;
55import type * as React from 'react' ;
6+ import { HapticStyles } from '@/types/haptic' ;
67
78import { cn } from '@/lib/utils' ;
89
@@ -35,20 +36,23 @@ const buttonVariants = cva(
3536export interface ButtonProps
3637 extends React . ButtonHTMLAttributes < HTMLButtonElement > ,
3738 VariantProps < typeof buttonVariants > {
39+ haptic ?: keyof typeof HapticStyles ;
3840 asChild ?: boolean ;
3941}
4042
4143const Button = ( {
4244 className,
4345 variant,
4446 size,
47+ haptic = 'impactLight' , // 기본 진동 설정
4548 asChild = false ,
4649 ...props
4750} : ButtonProps ) => {
4851 const Comp = asChild ? Slot : 'button' ;
4952 return (
5053 < Comp
5154 className = { cn ( buttonVariants ( { variant, size, className } ) ) }
55+ data-haptic = { haptic }
5256 { ...props }
5357 />
5458 ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * 지원 가능한 스타일 목록
3+ */
4+ export const HapticStyles = {
5+ impactLight : 'impactLight' ,
6+ impactMedium : 'impactMedium' ,
7+ impactHeavy : 'impactHeavy' ,
8+ selection : 'selection' ,
9+ notificationSuccess : 'notificationSuccess' ,
10+ notificationWarning : 'notificationWarning' ,
11+ notificationError : 'notificationError' ,
12+ } as const ;
You can’t perform that action at this time.
0 commit comments