import React from 'react' import { styled } from '@styled-components' import { Illustration, IllustrationVariant } from '../../atoms/illustration/index.js' import { Box, BoxProps } from '../../atoms/box/index.js' import { H4 } from '../../atoms/typography/index.js' import { cssClass } from '../../utils/css-class.js' const StyledInfoBox = styled(Box)` display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; text-align: center; ` /** * @memberof InfoBox * @alias InfoBoxProps */ export type InfoBoxProps = { /** Title of an InfoBox */ title?: string; /** Inner content - usually couple of {@link Text} nodes */ children: React.ReactNode; /** Infobox illustration {@link Illustration} or custom element above title */ illustration?: IllustrationVariant | React.ReactElement; /** Optional testId */ testId?: string; variant?: BoxProps['variant']; } /** * @classdesc * * * * Used for all type of information like: * * > you don't have x - please add first one" * * in the system. * * ### Usage * * ```javascript * import { InfoBox, InfoBoxProps } from '@adminjs/design-system' * ``` * * @component * @subcategory Molecules * @hideconstructor * @see {@link https://storybook.adminjs.co/?path=/story/designsystem-molecules-infobox--default Storybook} * @see InfoBoxProps * @example * return ( * * Currently there are no cars in the system * To create first click * * * ) * @section design-system */ const InfoBox: React.FC = ({ children, title, illustration, variant = 'transparent', testId }) => ( {illustration && typeof illustration === 'string' ? : illustration} {title &&

{title}

} {children}
) InfoBox.displayName = 'InfoBox' export { InfoBox } export default InfoBox