added inherit styling and pass className

This commit is contained in:
Florian Scholdei
2019-07-17 17:35:29 +02:00
parent 34c17b2206
commit 5774d8a1ee

View File

@@ -2,11 +2,18 @@
import * as React from "react";
import classNames from "classnames";
type NotificationType = "primary" | "info" | "success" | "warning" | "danger";
type NotificationType =
| "primary"
| "info"
| "success"
| "warning"
| "danger"
| "inherit";
type Props = {
type: NotificationType,
onClose?: () => void,
className?: string,
children?: React.Node
};
@@ -24,9 +31,12 @@ class Notification extends React.Component<Props> {
}
render() {
const { type, children } = this.props;
const { type, className, children } = this.props;
const color = type !== "inherit" ? "is-" + type : "";
return (
<div className={classNames("notification", "is-" + type)}>
<div className={classNames("notification", color, className)}>
{this.renderCloseButton()}
{children}
</div>