1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/ui/components/component-library/modal-overlay/modal-overlay.tsx
jainex d879f08763
Update ModalOverlay to use TS Box version (#20203)
* Update ModalOverlay to use TS Box version

* fix jest error

* lint error fix

* Fix lint errors and improve ModalOverlay's TypeScript typings

* Some small updates to story and docs

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2023-08-01 14:39:08 -07:00

36 lines
873 B
TypeScript

import React from 'react';
import classnames from 'classnames';
import {
BackgroundColor,
BlockSize,
} from '../../../helpers/constants/design-system';
import { Box, BoxProps } from '../box';
import type { PolymorphicRef } from '../box';
import {
ModalOverlayProps,
ModalOverlayComponent,
} from './modal-overlay.types';
export const ModalOverlay: ModalOverlayComponent = React.forwardRef(
<C extends React.ElementType = 'div'>(
{ onClick, className = '', ...props }: ModalOverlayProps<C>,
ref?: PolymorphicRef<C>,
) => (
<Box
className={classnames('mm-modal-overlay', className)}
ref={ref}
backgroundColor={BackgroundColor.overlayDefault}
width={BlockSize.Full}
height={BlockSize.Full}
onClick={onClick}
aria-hidden="true"
{...(props as BoxProps<C>)}
/>
),
);
export default ModalOverlay;