import { h } from 'preact'; import PropTypes from 'prop-types'; import { defaultChildrenPropTypes } from '../common-prop-types'; import { Button } from '@crayons'; export const snackbarItemProps = { children: defaultChildrenPropTypes.isRequired, actions: PropTypes.arrayOf( PropTypes.shape({ message: PropTypes.string.isRequired, handler: PropTypes.func.isRequired, lifespan: PropTypes.number.isRequired, }), ), }; export const SnackbarItem = ({ message, actions = [] }) => (
{message}
{actions.map(({ text, handler }) => ( ))}
); SnackbarItem.displayName = 'SnackbarItem'; SnackbarItem.propTypes = snackbarItemProps.isRequired;