lbry-desktop/ui/component/common/nag.jsx

30 lines
719 B
React
Raw Normal View History

2019-12-06 22:12:48 +01:00
// @flow
2020-02-21 22:05:20 +01:00
import type { Node } from 'react';
2019-12-06 22:12:48 +01:00
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
type Props = {
2020-02-21 22:05:20 +01:00
message: string | Node,
2019-12-06 22:12:48 +01:00
actionText: string,
href?: string,
onClick?: () => void,
onClose?: () => void,
};
export default function Nag(props: Props) {
const { message, actionText, href, onClick, onClose } = props;
const buttonProps = onClick ? { onClick } : { href };
return (
<div className="nag">
{message}
<Button className="nag__button" {...buttonProps}>
{actionText}
</Button>
{onClose && <Button className="nag__button nag__close" icon={ICONS.REMOVE} onClick={onClose} />}
</div>
);
}