summaryrefslogtreecommitdiff
path: root/source/github-widgets/notice-bar.tsx
blob: 0b6af2936b753c18bb6c73bde43a2836a1695204 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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<string | Node>,
	{
		type = 'notice',
		action = (
			<button className="flash-close js-flash-close" type="button" aria-label="Dismiss this message">
				<XIcon/>
			</button>
		),
	}: Options = {},
): Promise<void> {
	const container = await elementReady('#js-flash-container');
	container!.append(
		<div className={`flash flash-full flash-${type} px-4`}>
			{action}
			<div>
				{message}
			</div>
		</div>,
	);
}
s'>feat/foreign-keys Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/astro/test/fixtures/slots-react/src (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2024-03-28[ci] formatGravatar TK 1-2/+2
2024-03-28feat: allow dynamic route segments in isr.exclude array (#10513)Gravatar TK 5-3/+69
2024-03-28[ci] formatGravatar Houston (Bot) 2-3/+3
2024-03-28[ci] release (#10597)Gravatar Houston (Bot) 37-66/+89
2024-03-28db: Rework index config with generated index names (#10589)Gravatar Ben Holmes 6-68/+344