import { Meta, StoryObj } from "@storybook/react"; import React, { useEffect } from "react"; import { faker } from "@faker-js/faker"; import { Modal, ModalSize, useModal } from ":/components/Modal/index"; import { Button } from ":/components/Button"; import { CunninghamProvider } from ":/components/Provider"; const meta: Meta = { title: "Components/Modal", component: Modal, args: { children: "Description", title: "Title", }, decorators: [ (Story, context) => { const modal = useModal(); useEffect(() => { modal.open(); }, []); return ( ); }, ], parameters: { docs: { story: { height: "250px", }, }, }, }; export default meta; type Story = StoryObj; export const Small: Story = { args: { size: ModalSize.SMALL, }, }; export const Medium: Story = { args: { size: ModalSize.MEDIUM, }, }; export const Large: Story = { args: { size: ModalSize.LARGE, }, }; export const Full: Story = { args: { size: ModalSize.FULL, }, }; export const HideCloseButton: Story = { args: { size: ModalSize.MEDIUM, hideCloseButton: true, }, }; export const CloseOnClickOutside: Story = { args: { size: ModalSize.MEDIUM, hideCloseButton: true, closeOnClickOutside: true, }, }; export const PreventClose: Story = { args: { size: ModalSize.MEDIUM, preventClose: true, }, }; export const PrimaryButton: Story = { args: { size: ModalSize.MEDIUM, rightActions: ( ), }, }; export const SecondaryButton: Story = { args: { size: ModalSize.MEDIUM, rightActions: ( ), }, }; export const TwoButtons: Story = { args: { size: ModalSize.MEDIUM, leftActions: ( ), rightActions: ( ), }, }; export const ThreeButtons: Story = { args: { size: ModalSize.MEDIUM, leftActions: ( ), rightActions: ( <> ), }, }; export const CenterButtons: Story = { args: { size: ModalSize.MEDIUM, actions: ( <> ), }, }; export const ExampleApplication: Story = { args: { size: ModalSize.LARGE, title: "Application successful", titleIcon: done, children: ( <> Thank you for submitting your application! Your information has been received successfully.

You will receive a confirmation email shortly with the details of your submission. If there are any further steps required our team will be in touch. ), rightActions: , }, parameters: { docs: { story: { height: "500px", }, }, }, }; export const FullWithContent: Story = { args: { size: ModalSize.FULL, leftActions: , rightActions: ( <> ), children: faker.lorem.lines(400), }, };