Skip to content

Commit

Permalink
Allow ErrorModal to set Error props
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed Oct 18, 2023
1 parent 37f0f76 commit a0977ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/ErrorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import { Button } from "./Button";
import { Modal, ModalFooter, ModalPropTypes } from "./Modal";
import { Error } from "./Error";

type ErrorModalProps = React.PropsWithChildren<Omit<ModalPropTypes, 'variant' | 'heading'>>;
type ErrorModalProps = React.PropsWithChildren<Omit<ModalPropTypes, 'variant'>>;

export const ErrorModal = (props: ErrorModalProps) => {
return <Modal {...props} variant='error' heading='Error'>
<Error />
const { children, heading, ...modalProps } = props;

return <Modal {...modalProps} variant='error' heading='Error'>
<Error heading={heading}>
{children}
</Error>
<ModalFooter><Button onClick={props.onModalClose}>OK</Button></ModalFooter>
</Modal>;
};

0 comments on commit a0977ad

Please sign in to comment.