From 271ec17202ce7698e433b1de80dc19f7263df8fb Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 24 Jan 2023 18:52:00 -0800 Subject: [PATCH] Add Toast component --- components/Toast/index.scss | 0 components/Toast/index.tsx | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 components/Toast/index.scss create mode 100644 components/Toast/index.tsx diff --git a/components/Toast/index.scss b/components/Toast/index.scss new file mode 100644 index 00000000..e69de29b diff --git a/components/Toast/index.tsx b/components/Toast/index.tsx new file mode 100644 index 00000000..3e485ffc --- /dev/null +++ b/components/Toast/index.tsx @@ -0,0 +1,39 @@ +import React, { PropsWithChildren } from 'react' +import classNames from 'classnames' + +import * as ToastPrimitive from '@radix-ui/react-toast' +import './index.scss' + +interface Props { + className?: string + title?: string + content: string +} + +const Toast = ({ + children, + title, + content, + ...props +}: PropsWithChildren) => { + const classes = classNames(props.className, { + Toast: true, + }) + + return ( + + {title && {title}} + {content} + {children && ( + + {children} + + )} + + × + + + ) +} + +export default Toast