diff options
author | 2020-11-21 13:27:14 -0600 | |
---|---|---|
committer | 2020-11-21 13:27:14 -0600 | |
commit | c99595dc4755c99a6aa05a237c952bc1d9c08dfb (patch) | |
tree | 9244ead59ed89b09cb07e60f93d0271d2edfd724 /source/github-widgets | |
parent | 1bedcd71886ac9c20bf91a6d48e428622ab6d1b1 (diff) | |
download | refined-github-c99595dc4755c99a6aa05a237c952bc1d9c08dfb.tar.gz refined-github-c99595dc4755c99a6aa05a237c952bc1d9c08dfb.tar.zst refined-github-c99595dc4755c99a6aa05a237c952bc1d9c08dfb.zip |
Add `quick-fork-deletion` feature (#3734)
Diffstat (limited to 'source/github-widgets')
-rw-r--r-- | source/github-widgets/notice-bar.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/github-widgets/notice-bar.tsx b/source/github-widgets/notice-bar.tsx new file mode 100644 index 00000000..9fec13d8 --- /dev/null +++ b/source/github-widgets/notice-bar.tsx @@ -0,0 +1,29 @@ +import React from 'dom-chef'; +import XIcon from 'octicon/x.svg'; +import select from 'select-dom'; + +interface Options { + action?: Element | false; + type?: 'success' | 'notice' | 'warn' | 'error'; +} + +/** https://primer.style/css/components/alerts */ +export default 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 = {} +): void { + select('#start-of-content')!.after( + <div className={`flash flash-full flash-${type}`}> + <div className="container-lg px-3 d-flex flex-items-center flex-justify-between"> + <div>{message}</div> {action} + </div> + </div> + ); +} |