kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
update modal to accept background and shadow as props
rodzic
14d2819f98
commit
0e373cfb98
|
@ -45,8 +45,12 @@ interface IModal {
|
||||||
confirmationFullWidth?: boolean;
|
confirmationFullWidth?: boolean;
|
||||||
/** Callback when the modal is closed. */
|
/** Callback when the modal is closed. */
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
/** Set whether the modal has padding. */
|
/** Sets whether the modal will have a custom padding different from the default one. */
|
||||||
padding?: string;
|
padding?: string;
|
||||||
|
/** Sets whether the modal will have a custom shadow different from the default one. */
|
||||||
|
shadow?: string;
|
||||||
|
/** Sets whether the modal will have a custom background different from the default one. */
|
||||||
|
background?: string;
|
||||||
/** Callback when the secondary action is chosen. */
|
/** Callback when the secondary action is chosen. */
|
||||||
secondaryAction?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
|
secondaryAction?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
|
||||||
/** Secondary button text. */
|
/** Secondary button text. */
|
||||||
|
@ -76,6 +80,8 @@ const Modal = React.forwardRef<HTMLDivElement, IModal>(({
|
||||||
confirmationFullWidth,
|
confirmationFullWidth,
|
||||||
onClose,
|
onClose,
|
||||||
padding = 'p-6',
|
padding = 'p-6',
|
||||||
|
shadow = 'shadow-xl',
|
||||||
|
background = 'bg-white',
|
||||||
secondaryAction,
|
secondaryAction,
|
||||||
secondaryDisabled = false,
|
secondaryDisabled = false,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
|
@ -98,7 +104,7 @@ const Modal = React.forwardRef<HTMLDivElement, IModal>(({
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
data-testid='modal'
|
data-testid='modal'
|
||||||
className={clsx(className, 'pointer-events-auto mx-auto block w-full rounded-2xl bg-white text-start align-middle text-gray-900 shadow-xl transition-all black:bg-black dark:bg-primary-900 dark:text-gray-100', padding , widths[width])}
|
className={clsx(className, 'pointer-events-auto mx-auto block w-full rounded-2xl text-start align-middle text-gray-900 transition-all black:bg-black dark:bg-primary-900 dark:text-gray-100', padding, background, shadow , widths[width])}
|
||||||
>
|
>
|
||||||
<div className='w-full justify-between sm:flex sm:items-start'>
|
<div className='w-full justify-between sm:flex sm:items-start'>
|
||||||
<div className='w-full'>
|
<div className='w-full'>
|
||||||
|
|
Ładowanie…
Reference in New Issue