-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 재사용 가능한 AlertDialog 컴포넌트 생성 * feat: 현재 게임방 이름 세션 스토리지 저장 후 강퇴 시 CustomAlertDialog 띄우기
- Loading branch information
1 parent
d41a38a
commit 83a62b2
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogTitle, | ||
} from '@/components/ui/alert-dialog'; | ||
|
||
interface CustomAlertDialogProps { | ||
open: boolean; | ||
onOpenChange: (open: boolean) => void; | ||
title: string; | ||
description?: string; | ||
actionText?: string; | ||
} | ||
|
||
const CustomAlertDialog = ({ | ||
open, | ||
onOpenChange, | ||
title, | ||
description, | ||
actionText = '확인', | ||
}: CustomAlertDialogProps) => { | ||
return ( | ||
<AlertDialog open={open} onOpenChange={onOpenChange}> | ||
<AlertDialogContent className="font-galmuri sm:max-w-[22rem]"> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>{title}</AlertDialogTitle> | ||
{description && ( | ||
<AlertDialogDescription>{description}</AlertDialogDescription> | ||
)} | ||
</AlertDialogHeader> | ||
<AlertDialogFooter> | ||
<AlertDialogAction className="bg-primary hover:bg-primary/90"> | ||
{actionText} | ||
</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
}; | ||
|
||
export default CustomAlertDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters