Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

모달 스타일 임시 수정 #169

Merged
merged 2 commits into from
Jun 11, 2024
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
4 changes: 2 additions & 2 deletions client/src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Modal() {
<>
{type !== ModalType.CLOSE && (
<div className="relative z-20">
<div className="fixed inset-0 bg-gray-500 bg-opacity-75"></div>
<div className="fixed inset-0 bg-opacity-75 bg-gray-scale-100"></div>
<div className="fixed inset-0 z-20 overflow-y-auto">
<div className="flex items-end justify-center min-h-full p-4 text-center sm:items-center sm:p-0">
<div className="relative w-full overflow-hidden text-left transition-all delay-1000 transform bg-white rounded-lg shadow-xl sm:my-8 sm:max-w-lg">
Expand All @@ -37,7 +37,7 @@ export default function Modal() {
</div>
</div>

<div className="px-4 py-3 bg-gray-50 sm:flex sm:flex-row-reverse sm:px-6">
<div className="flex gap-3 px-4 py-3 [&>:nth-child(n)]:grow bg-gray-50 sm:flex-row-reverse sm:px-6 sm:[&>:nth-child(n)]:grow-0">
{IS_CONFIRM_MODAL ? (
<>
<ModalButton
Expand Down
24 changes: 14 additions & 10 deletions client/src/components/Modal/modal-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import React, { useEffect } from 'react';

// components
import Button, { ButtonColorType } from '../base/Button';

interface IType {
type: 'check' | 'yes' | 'cancle';
onClick: () => void;
Expand All @@ -10,26 +13,27 @@ interface IType {
const CONTENT = {
check: {
content: '확인',
className:
'inline-flex w-full justify-center rounded-md bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 sm:ml-3 sm:w-auto',
color: 'yellow',
},
yes: {
content: '예',
className:
'inline-flex w-full justify-center rounded-md bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 sm:ml-3 sm:w-auto',
color: 'yellow',
},
cancle: {
content: '취소',
className:
'inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto',
color: 'yellow_line',
},
};

export default function ModalButton({ type, onClick }: IType) {
const { content, className } = CONTENT[type];
const { content, color } = CONTENT[type] as {
content: string;
color: ButtonColorType;
};

const handdleKeyup = (e: KeyboardEvent) => {
if ((e.keyCode === 13 || e.keyCode === 27) && type !== 'cancle') {
const key = e.key || e.keyCode;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyCode가 duprecated 됨에 따라 코드 수정, 하지만 e.key를 지원하지 않는 브라우저도 있다고 하여 남겨놓음

이슈 내용

if ((key === 13 || key === 27) && type !== 'cancle') {
onClick();
}
};
Expand All @@ -39,8 +43,8 @@ export default function ModalButton({ type, onClick }: IType) {
return () => document.removeEventListener('keyup', handdleKeyup);
}, []);
return (
<button type="button" className={className} onClick={onClick}>
<Button type="button" color={color} onClick={onClick}>
{content}
</button>
</Button>
);
}
2 changes: 1 addition & 1 deletion client/src/components/Modal/modal-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function ModalIcon({ type }: IType) {
<div
className={`mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-${color}-100 sm:mx-0 sm:h-10 sm:w-10`}
>
<Icon icon={shape} color={color} fontSize={24} />
<Icon icon={shape} color={color} fontSize={36} />
</div>
);
}
2 changes: 1 addition & 1 deletion client/src/components/base/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Button(props: ButtonProps) {

return (
<button
className={`h-8 px-5 py-1 text-body2 leading-[20.48px] tracking-[-0.32px] flex gap-[6px] rounded-[2px] items-center text-nowrap ${
className={`h-8 px-5 py-1 text-body2 leading-[20.48px] tracking-[-0.32px] flex gap-[6px] rounded-[2px] items-center justify-center text-nowrap ${
style[props.color]
} `}
{...props}
Expand Down
Loading