From d2c2cc62a4c2e1ac10f8434bea7bb834da820869 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 16 Jan 2021 11:40:36 +0100 Subject: semi working next project --- components/toast.tsx | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 components/toast.tsx (limited to 'components/toast.tsx') diff --git a/components/toast.tsx b/components/toast.tsx new file mode 100644 index 0000000..1d467bd --- /dev/null +++ b/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 From 0c947a9f7d4ff3f9e65d01df21d6d50e9fa51095 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 31 Jan 2021 14:29:48 +0100 Subject: toast color fix --- components/toast.tsx | 4 ++-- pages/index.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'components/toast.tsx') diff --git a/components/toast.tsx b/components/toast.tsx index 1d467bd..e01683f 100644 --- a/components/toast.tsx +++ b/components/toast.tsx @@ -41,8 +41,8 @@ export class Toast extends Component<{ boxShadow: "0 8px 12px -4px #00000033", backgroundColor: this.props.type === "normal" ? "var(--background)" : - this.props.type === "confirmation" ? "var(--disk-a)" : - this.props.type === "error" ? "var(--disk-b)" : "var(--background)", + this.props.type === "confirmation" ? "var(--disk-b)" : + this.props.type === "error" ? "var(--disk-a)" : "var(--background)", ...this.props.style }}> { diff --git a/pages/index.tsx b/pages/index.tsx index bd7100e..ff4e2b7 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,4 +1,4 @@ -import { CSSProperties, Component, useEffect } from 'react'; +import { CSSProperties, Component } from 'react'; import axios from 'axios'; import { userInfo } from '../api/api'; @@ -82,8 +82,9 @@ export default class HomePage extends Component { return
- }/> - + }/> + + 4 op een rij -- cgit v1.2.3