feat(frontend): 공통 토스트(sonner)·모달 컴포넌트 추가
- sonner 기반 토스트 래퍼(lib/toast): error/info/success/warning, 프로젝트 디자인 토큰으로 스타일 통일. Toaster 를 provider 에 마운트 - 공통 Modal 컴포넌트: 반투명 배경 + 배경 클릭/ESC 닫기 - core/Provider import 케이싱 정리(provider) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a867daa98f
commit
7bdd10207a
8 files changed
+130
-2
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { type ReactNode, useEffect } from 'react'
|
||||
|
||||
export interface ModalProps {
|
||||
children?: ReactNode
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
// 공통 모달: 반투명 배경 + 배경 클릭/ESC 로 닫기.
|
||||
export function Modal({ children, onClose }: ModalProps) {
|
||||
const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (e.target === e.currentTarget) onClose()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleEscKey = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') onClose()
|
||||
}
|
||||
document.addEventListener('keydown', handleEscKey)
|
||||
return () => document.removeEventListener('keydown', handleEscKey)
|
||||
}, [onClose])
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-[rgba(0,0,0,0.40)]"
|
||||
onClick={handleBackdropClick}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
export { Button } from '@/components/Button'
|
||||
export type { ButtonProps, ButtonVariant, ButtonSize } from '@/components/Button'
|
||||
export { Input } from '@/components/Input'
|
||||
export { Modal } from '@/components/Modal'
|
||||
export type { ModalProps } from '@/components/Modal'
|
||||
export { Logo } from '@/components/Logo'
|
||||
export type { LogoProps, LogoVariant } from '@/components/Logo'
|
||||
Reference in new issue
Block a user