forked from refined-github/refined-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanner.tsx
More file actions
25 lines (23 loc) · 808 Bytes
/
banner.tsx
File metadata and controls
25 lines (23 loc) · 808 Bytes
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
import React from 'dom-chef';
type BannerProps = {
text: Array<string | JSX.Element> | string | JSX.Element;
url?: string;
buttonLabel: JSX.Element | string;
classes?: string[];
};
// This could be a `<Banner/>` element but dom-chef doesn't pass props
// https://github.com/vadimdemedes/dom-chef/issues/77
export default function createBanner(props: BannerProps): JSX.Element {
// Classes copied from "had recent pushes" banner from repo home
return (
<div className={['flash', ...props.classes ?? ''].join(' ')}>
<div className="d-sm-flex">
<div className="flex-auto">{props.text}</div>
{props.url && (
<a href={props.url} className="flex-shrink-0 btn btn-sm ml-sm-3 mt-2 mt-sm-n2 mb-sm-n2 mr-sm-n1 flex-self-center">
{props.buttonLabel}
</a>)}
</div>
</div>
);
}