Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { useModalActions } from '../../hooks/useModal.ts';
import { createPortal } from 'react-dom';
import type { ReactNode } from 'react';

interface ModalProps {
title?: string;
subtitle: string;
subtitle?: ReactNode;
buttonText?: string;
buttonColor?: string;
onClick?: () => void;
}

const Modal = ({ title = '알림', subtitle }: ModalProps) => {
const Modal = ({
title = '알림',
subtitle = <>정말로 삭제하시겠습니까?</>,
buttonText = '확인',
buttonColor = 'bg-primary-blue',
onClick = () => {},
}: ModalProps) => {
const { closeModal } = useModalActions();

return createPortal(
Expand All @@ -19,10 +29,13 @@ const Modal = ({ title = '알림', subtitle }: ModalProps) => {
<p className={`text-gray-600 font-body-r mb-[2.4rem]`}>{subtitle}</p>
<div className={`flex justify-end`}>
<button
className={`px-[1.6rem] py-[0.8rem] rounded-[0.6rem] bg-primary-blue text-zinc-50 font-small-b`}
onClick={closeModal}
className={`px-[1.6rem] py-[0.8rem] rounded-[0.6rem] ${buttonColor} text-zinc-50 font-small-b`}
onClick={() => {
onClick();
closeModal();
}}
>
확인
{buttonText}
</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
--color-gray-600: #111111;

/* Error Scale */
--color-red-400: #d44242;
--color-error-400: #d44242;

/* Primary Color */
--color-primary-blue: #132650;
Expand Down