(react) add Modal

Here it is! Our really wanted Modal component, based on Figma sketches.
This commit is contained in:
Nathan Vasse
2024-01-18 14:38:48 +01:00
committed by NathanVss
parent 81e4da1d36
commit 1445f4a222
32 changed files with 1723 additions and 111 deletions

View File

@@ -0,0 +1,44 @@
import React from "react";
import { Modal, ModalSize } from ":/components/Modal/index";
import { useCunningham } from ":/components/Provider";
import { Button } from ":/components/Button";
import { DecisionModalProps } from ":/components/Modal/ModalProvider";
export type DeleteConfirmationModalProps = DecisionModalProps;
export const DeleteConfirmationModal = ({
title,
children,
onDecide,
...props
}: DeleteConfirmationModalProps) => {
const { t } = useCunningham();
return (
<Modal
title={title ?? t("components.modals.helpers.delete_confirmation.title")}
titleIcon={<span className="material-icons clr-danger-600">delete</span>}
size={ModalSize.SMALL}
actions={
<>
<Button
color="secondary"
fullWidth={true}
onClick={() => onDecide(null)}
>
{t("components.modals.helpers.delete_confirmation.cancel")}
</Button>
<Button
fullWidth={true}
onClick={() => onDecide("delete")}
color="danger"
>
{t("components.modals.helpers.delete_confirmation.delete")}
</Button>
</>
}
{...props}
>
{children ?? t("components.modals.helpers.delete_confirmation.children")}
</Modal>
);
};