import React from 'dom-chef'; import {XIcon} from '@primer/octicons-react'; import elementReady from 'element-ready'; type Options = { action?: Element | false; type?: 'success' | 'notice' | 'warn' | 'error'; }; /** https://primer.style/css/components/alerts */ export default async function addNotice( message: string | Node | Array, { type = 'notice', action = ( ), }: Options = {}, ): Promise { const container = await elementReady('#js-flash-container'); container!.append(
{action}
{message}
, ); }