Skip to content

Commit

Permalink
[fix]協賛一覧のmodalclose
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubosaka committed Jul 7, 2024
1 parent 4c763f3 commit 22dd2db
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
10 changes: 9 additions & 1 deletion view/next-project/src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default function Modal(props: Props) {

useEffect(stopScrollingBackContent, []);

const preventCloseModalEvent = (event: any) => {
event.stopPropagation();
};

const className =
'relative sm:my-6 mx-auto bg-white-0 rounded-lg p-5' +
(props.className ? ` ${props.className}` : '');
Expand All @@ -28,7 +32,11 @@ export default function Modal(props: Props) {
className='fixed inset-0 z-50 flex items-center justify-center overflow-y-auto overflow-x-hidden bg-black-300/50 outline-none focus:outline-none'
onClick={props.onClick}
>
<div className={clsx(className)} style={{ maxHeight: '90vh', overflowY: 'auto' }}>
<div
className={clsx(className)}
style={{ maxHeight: '90vh', overflowY: 'auto' }}
onClick={preventCloseModalEvent}
>
{props.children}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion view/next-project/src/components/sponsors/DeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SponsorDeleteModal: FC<ModalProps> = (props) => {
};

return (
<Modal className='md:w-1/2'>
<Modal className='md:w-1/2' onClick={() => props.setShowModal(false)}>
<div className='w-full'>
<div className='ml-auto w-fit'>
<CloseButton onClick={() => props.setShowModal(false)} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function SponsorAddModal() {
};

return (
<Modal className='md:w-1/2'>
<Modal className='md:w-1/2' onClick={closeModal}>
<div className='w-full'>
<div className='ml-auto mr-5 w-fit'>
<CloseButton onClick={closeModal} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ export default function SponsorEditModal(props: Props) {

const [isChecked, setIsChecked] = useState<boolean>(true);

const closeModal = () => {
props.setIsOpen(false);
};

return (
<Modal className='md:w-1/2'>
<Modal className='md:w-1/2' onClick={closeModal}>
<div className='w-full'>
<div className='ml-auto mr-5 w-fit'>
<CloseButton onClick={() => props.setIsOpen(false)} />
Expand Down

0 comments on commit 22dd2db

Please sign in to comment.