From be52cd3265f93b09fc400ecaa58cde0a93ed41e6 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 16 Jan 2021 10:38:15 +0100 Subject: notification be gone --- src/components/toast.tsx | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/components/toast.tsx (limited to 'src/components/toast.tsx') diff --git a/src/components/toast.tsx b/src/components/toast.tsx new file mode 100644 index 0000000..1d467bd --- /dev/null +++ b/src/components/toast.tsx @@ -0,0 +1,78 @@ +import { CSSProperties, ReactNode, Component } from "react"; + +import CloseIcon from '@material-ui/icons/Close'; + +export function ToastArea(props: { + style?: CSSProperties + children?: ReactNode +}) { + return
{props.children}
+} + +export class Toast extends Component<{ + text?: string + icon?: ReactNode + children?: ReactNode + type?: "normal"|"confirmation"|"error" + style?: CSSProperties +}> { + state = { render: true } + + close = () => this.setState({ render: false }) + + render () { + if (!this.state.render) return null; + return
+ { + this.props.children ? + this.props.children : +
+
{this.props.icon}
+

{this.props.text}

+
+ +
+
+ } +
+ } +} + -- cgit v1.2.3