📝(doc) upgrade doc for Storybook v8

The Canvas block does not handle free source code anymore, now we need
to put it in a dedicated Story.
This commit is contained in:
Nathan Vasse
2024-03-14 17:16:03 +01:00
committed by NathanVss
parent 112f59dd90
commit 1f80674717
15 changed files with 258 additions and 107 deletions

View File

@@ -1,4 +1,4 @@
import { Canvas, Meta, Story, Source, ArgTypes } from '@storybook/blocks';
import { Canvas, Meta, Source, ArgTypes } from '@storybook/blocks';
import * as Stories from './index.stories';
import * as PreBuiltStories from './PreBuilt.stories';
import { Modal } from './index';

View File

@@ -36,20 +36,19 @@ export const useModal = ({
};
};
export interface ModalProps
extends PropsWithChildren<{
size: ModalSize;
isOpen: boolean;
onClose: () => void;
leftActions?: React.ReactNode;
rightActions?: React.ReactNode;
actions?: React.ReactNode;
title?: ReactNode;
titleIcon?: React.ReactNode;
hideCloseButton?: boolean;
closeOnClickOutside?: boolean;
preventClose?: boolean;
}> {}
export type ModalProps = PropsWithChildren & {
size: ModalSize;
isOpen: boolean;
onClose: () => void;
leftActions?: React.ReactNode;
rightActions?: React.ReactNode;
actions?: React.ReactNode;
title?: ReactNode;
titleIcon?: React.ReactNode;
hideCloseButton?: boolean;
closeOnClickOutside?: boolean;
preventClose?: boolean;
};
export const Modal = (props: ModalProps) => {
/**
@@ -157,7 +156,11 @@ export const ModalInner = (props: ModalProps) => {
);
};
const ModalFooter = ({ leftActions, rightActions, actions }: ModalProps) => {
const ModalFooter = ({
leftActions,
rightActions,
actions,
}: Pick<ModalProps, "leftActions" | "rightActions" | "actions">) => {
if ((leftActions || rightActions) && actions) {
throw new Error("Cannot use leftActions or rightActions with actions");
}