Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -50,7 +50,7 @@ export const StyledConfirmationButton = styled(StyledCenteredButton)`
|
||||
}
|
||||
`;
|
||||
|
||||
export function ConfirmationModal({
|
||||
export const ConfirmationModal = ({
|
||||
isOpen = false,
|
||||
title,
|
||||
subtitle,
|
||||
@ -59,7 +59,7 @@ export function ConfirmationModal({
|
||||
deleteButtonText = 'Delete',
|
||||
confirmationValue,
|
||||
confirmationPlaceholder,
|
||||
}: ConfirmationModalProps) {
|
||||
}: ConfirmationModalProps) => {
|
||||
const [inputConfirmationValue, setInputConfirmationValue] =
|
||||
useState<string>('');
|
||||
const [isValidValue, setIsValidValue] = useState(!confirmationValue);
|
||||
@ -126,4 +126,4 @@ export function ConfirmationModal({
|
||||
</LayoutGroup>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -98,21 +98,21 @@ const StyledBackDrop = styled(motion.div)`
|
||||
*/
|
||||
type ModalHeaderProps = React.PropsWithChildren & React.ComponentProps<'div'>;
|
||||
|
||||
function ModalHeader({ children, ...restProps }: ModalHeaderProps) {
|
||||
return <StyledHeader {...restProps}>{children}</StyledHeader>;
|
||||
}
|
||||
const ModalHeader = ({ children, ...restProps }: ModalHeaderProps) => (
|
||||
<StyledHeader {...restProps}>{children}</StyledHeader>
|
||||
);
|
||||
|
||||
type ModalContentProps = React.PropsWithChildren & React.ComponentProps<'div'>;
|
||||
|
||||
function ModalContent({ children, ...restProps }: ModalContentProps) {
|
||||
return <StyledContent {...restProps}>{children}</StyledContent>;
|
||||
}
|
||||
const ModalContent = ({ children, ...restProps }: ModalContentProps) => (
|
||||
<StyledContent {...restProps}>{children}</StyledContent>
|
||||
);
|
||||
|
||||
type ModalFooterProps = React.PropsWithChildren & React.ComponentProps<'div'>;
|
||||
|
||||
function ModalFooter({ children, ...restProps }: ModalFooterProps) {
|
||||
return <StyledFooter {...restProps}>{children}</StyledFooter>;
|
||||
}
|
||||
const ModalFooter = ({ children, ...restProps }: ModalFooterProps) => (
|
||||
<StyledFooter {...restProps}>{children}</StyledFooter>
|
||||
);
|
||||
|
||||
/**
|
||||
* Modal
|
||||
@ -136,7 +136,7 @@ const modalVariants = {
|
||||
exit: { opacity: 0 },
|
||||
};
|
||||
|
||||
export function Modal({
|
||||
export const Modal = ({
|
||||
isOpen = false,
|
||||
children,
|
||||
onClose,
|
||||
@ -145,7 +145,7 @@ export function Modal({
|
||||
size = 'medium',
|
||||
padding = 'medium',
|
||||
...restProps
|
||||
}: ModalProps) {
|
||||
}: ModalProps) => {
|
||||
const modalRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useListenClickOutside({
|
||||
@ -211,7 +211,7 @@ export function Modal({
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Modal.Header = ModalHeader;
|
||||
Modal.Content = ModalContent;
|
||||
|
||||
Reference in New Issue
Block a user