diff --git a/package/src/components/Toast/Toast.js b/package/src/components/Toast/Toast.js index c042b34d..0b478b5b 100644 --- a/package/src/components/Toast/Toast.js +++ b/package/src/components/Toast/Toast.js @@ -18,6 +18,7 @@ const Toast = React.forwardRef(function Toast(props, ref) { @@ -36,6 +37,7 @@ Toast.propTypes = { * Message */ message: PropTypes.string, + title: PropTypes.string, /** * Variant: Info, Success, Warning, Error */ diff --git a/package/src/components/Toast/Toast.md b/package/src/components/Toast/Toast.md index f7a7629a..642370f8 100644 --- a/package/src/components/Toast/Toast.md +++ b/package/src/components/Toast/Toast.md @@ -52,8 +52,6 @@ function OpenToast() { #### Types - - ##### Information @@ -101,4 +99,151 @@ function OpenToast(props) { } +``` + +##### Success + + + +Use a X component to allow a user to XX, such as XYXY. + +```jsx +import Button from "../Button"; +import IconButton from "@material-ui/core/IconButton"; + +function OpenToast(props) { + const [open, setOpen] = React.useState(false); + + const handleClick = () => { + setOpen(true); + }; + + const handleClose = (event, reason) => { + if (reason === 'clickaway') { + return; + } + + setOpen(false); + }; + + return ( +
+ + +
+ ); +} + + +``` + +##### Warning + + + +Use a X component to allow a user to XX, such as XYXY. + +```jsx +import Button from "../Button"; +import IconButton from "@material-ui/core/IconButton"; + +function OpenToast(props) { + const [open, setOpen] = React.useState(false); + + const handleClick = () => { + setOpen(true); + }; + + const handleClose = (event, reason) => { + if (reason === 'clickaway') { + return; + } + + setOpen(false); + }; + + return ( +
+ + +
+ ); +} + + +``` + +##### Error + + + +Use a X component to allow a user to XX, such as XYXY. + +```jsx +import Button from "../Button"; +import IconButton from "@material-ui/core/IconButton"; + +function OpenToast(props) { + const [open, setOpen] = React.useState(false); + + const handleClick = () => { + setOpen(true); + }; + + const handleClose = (event, reason) => { + if (reason === 'clickaway') { + return; + } + + setOpen(false); + }; + + return ( +
+ + +
+ ); +} + + ``` \ No newline at end of file diff --git a/package/src/components/Toast/helpers/ToastWrapper.js b/package/src/components/Toast/helpers/ToastWrapper.js index f0ab0762..7aa463ca 100644 --- a/package/src/components/Toast/helpers/ToastWrapper.js +++ b/package/src/components/Toast/helpers/ToastWrapper.js @@ -8,12 +8,14 @@ const useStyles = makeStyles((theme) => ({ success: { fontSize: theme.typography.fontSize, backgroundColor: theme.palette.colors.forestGreenBackground, - color: theme.palette.colors.black + color: theme.palette.colors.black, + border: `2px solid ${theme.palette.colors.forestGreenBorder}` }, error: { fontSize: theme.typography.fontSize, backgroundColor: theme.palette.colors.redBackground, - color: theme.palette.colors.black + color: theme.palette.colors.black, + border: `2px solid ${theme.palette.colors.redBorder}` }, info: { fontSize: theme.typography.fontSize, @@ -24,7 +26,8 @@ const useStyles = makeStyles((theme) => ({ warning: { fontSize: theme.typography.fontSize, backgroundColor: theme.palette.colors.yellowBackground, - color: theme.palette.colors.black + color: theme.palette.colors.black, + border: `2px solid ${theme.palette.colors.yellowBorder}` }, message: { display: "flex", @@ -46,14 +49,13 @@ export default function ToastWrapper(props) { className={clsx(classes[variant], className)} message={message} {...otherProps} - > -
{message}
- + /> ); } ToastWrapper.propTypes = { className: PropTypes.string, message: PropTypes.string, + title: PropTypes.string, variant: PropTypes.oneOf(["error", "info", "success", "warning"]).isRequired };