(props: BannerProps)
| 16 | // This could be a `<Banner/>` element but dom-chef doesn't pass props |
| 17 | // https://github.com/vadimdemedes/dom-chef/issues/77 |
| 18 | export default function createBanner(props: BannerProps): JSX.Element { |
| 19 | let button: JSX.Element | undefined; |
| 20 | |
| 21 | if (typeof props.action === 'string') { |
| 22 | button = ( |
| 23 | <a href={props.action} className={classes}> |
| 24 | {props.buttonLabel} |
| 25 | </a> |
| 26 | ); |
| 27 | } else if (typeof props.action === 'function') { |
| 28 | button = ( |
| 29 | <button type="button" className={classes} onClick={props.action}> |
| 30 | {props.buttonLabel} |
| 31 | </button> |
| 32 | ); |
| 33 | } |
| 34 | |
| 35 | return ( |
| 36 | <div className={cx('flash', props.classes)}> |
| 37 | <div className="d-sm-flex flex-items-center gap-2"> |
| 38 | <div className="d-flex flex-auto flex-self-center flex-items-center gap-2"> |
| 39 | {props.icon} |
| 40 | <span>{props.text}</span> |
| 41 | </div> |
| 42 | {button} |
| 43 | </div> |
| 44 | </div> |
| 45 | ); |
| 46 | } |
no outgoing calls
no test coverage detected