-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8384ce2
commit bce44a5
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className={`Toast Toast--${props.category}`}> | ||
<main className="Toast__message"> | ||
<header className="Toast__message-category">{props.category}</header> | ||
<p className="Toast__message-text">{props.message}</p> | ||
</main> | ||
<button className="Toast__button" type="button" onClick={() => props.dismiss(props.id)}> | ||
Dismiss | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
// class App extends React.Component { | ||
// render() { | ||
// return ( | ||
// <div> | ||
// {toasts.map((toast, i) => ( | ||
// <Toast category={toast.category} key={i} message={toast.message} /> | ||
// ))} | ||
// </div> | ||
// ); | ||
// } | ||
// } | ||
|
||
export default Toast; |