From bce44a588acd3217a04994fd6dabe9e1775b6123 Mon Sep 17 00:00:00 2001 From: hosead6168 Date: Mon, 21 Mar 2022 04:36:19 -0500 Subject: [PATCH] feat(*): added toast --- src/Components/Toast/Toast.css | 50 ++++++++++++++++++++++++++++++++++ src/Components/Toast/Toast.jsx | 44 ++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/Components/Toast/Toast.css create mode 100644 src/Components/Toast/Toast.jsx diff --git a/src/Components/Toast/Toast.css b/src/Components/Toast/Toast.css new file mode 100644 index 00000000..bf524ba1 --- /dev/null +++ b/src/Components/Toast/Toast.css @@ -0,0 +1,50 @@ + +.Toast { + background: white; + border-left: 1rem solid #8a8a8a; + border-radius: 0.5rem; + box-shadow: 0.125rem 0.125rem 0.25rem rgba(0, 0, 0, 0.25); + display: flex; + font-family: Helvetica; + justify-content: space-between; + padding: 1rem; + margin: 1rem auto; + width: 25rem; +} + +.Toast--success { + border-color: #008554; +} + +.Toast--warning { + border-color: #FFC627; +} + +.Toast--error { + border-color: #D14229; +} + +.Toast__message-category { + font-weight: bold; + font-size: 1.25rem; + margin-bottom: 0.5rem; + margin-top: 0; + text-transform: capitalize; +} + +.Toast__message-text { + margin-bottom: 0; +} + +.Toast__button { + background: transparent; + border: none; + font-family: inherit; + font-size: inherit; + margin-left: 1rem; + opacity: 0.5; + padding: 0; +} +Run Pen + +Resources diff --git a/src/Components/Toast/Toast.jsx b/src/Components/Toast/Toast.jsx new file mode 100644 index 00000000..53c7a525 --- /dev/null +++ b/src/Components/Toast/Toast.jsx @@ -0,0 +1,44 @@ +import React from 'react'; +import './Toast.css' +const toasts = [ + { + category: "success", + message: "Right on! Your account has been updated." + }, + { + category: "warning", + message: "Hmmm. Something doesn't look right." + }, + { + category: "error", + message: "Uh oh! Something went terribly wrong!" + } +]; + +function Toast(props) { + return ( +
+
+
{props.category}
+

{props.message}

+
+ +
+ ); +} + +// class App extends React.Component { +// render() { +// return ( +//
+// {toasts.map((toast, i) => ( +// +// ))} +//
+// ); +// } +// } + +export default Toast;