Skip to content

Commit

Permalink
feat: needCloseButton props
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper200207 committed Jan 1, 2025
1 parent 4f73200 commit 667ae34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/Modal/ActionModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Text, Modal, ModalOverlay, ModalContent, ModalFooter, ModalBody, Button } from '@chakra-ui/react';
import { Text, Modal, ModalOverlay, ModalContent, ModalFooter, ModalBody, Button, Flex } from '@chakra-ui/react';

import { ActionModalProps } from '../types';

const ActionModal = ({
isOpen,
needCloseButton = false,
onClose,
title,
children,
Expand All @@ -17,9 +18,16 @@ const ActionModal = ({
<Modal isCentered isOpen={isOpen} onClose={onClose} size={size || 'md'}>
<ModalOverlay />
<ModalContent rounded="2xl">
<Text textStyle="bold_2xl" px="4" pt="4">
{title}
</Text>
<Flex>
<Text textStyle="bold_2xl" px="4" pt="4">
{title}
</Text>
{needCloseButton && (
<Text mx="5" mt="4" ml="auto" fontWeight="bold" cursor="pointer" onClick={onClose}>
X
</Text>
)}
</Flex>
<ModalBody p="4">{children}</ModalBody>
<ModalFooter justifyContent="end" gap="4" pt="0" pb="4">
<Button onClick={onSubButtonClick} variant="white">
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface ActionModalProps {
isOpen: boolean;
needCloseButton?: boolean;
onClose: () => void;
title: string;
children: React.ReactNode;
Expand Down

0 comments on commit 667ae34

Please sign in to comment.