From 38ab8fe12c7eefc73fa9b3f06137f7c3c22bee1c Mon Sep 17 00:00:00 2001 From: JF-Cozy Date: Fri, 1 Jul 2022 16:22:11 +0200 Subject: [PATCH] feat(Snackbar): Modify default behavior of Snackbar and add Alert expl --- react/MuiCozyTheme/makeOverrides.js | 13 +++++ react/Snackbar/Readme.md | 82 ++++++++++++++++++++++++++++- react/Snackbar/index.js | 18 ++++++- 3 files changed, 111 insertions(+), 2 deletions(-) diff --git a/react/MuiCozyTheme/makeOverrides.js b/react/MuiCozyTheme/makeOverrides.js index 364acd5400..250e5ec944 100644 --- a/react/MuiCozyTheme/makeOverrides.js +++ b/react/MuiCozyTheme/makeOverrides.js @@ -916,6 +916,12 @@ const makeOverrides = theme => ({ width: '100%', fontWeight: 'bold' } + }, + MuiSnackbarContent: { + root: { + padding: '4px 12px', + backgroundColor: theme.palette.grey[600] + } } }) @@ -991,6 +997,13 @@ const makeInvertedOverrides = invertedTheme => { '&-info': makeAlertInvertedColor(invertedTheme, 'info') } } + }, + MuiSnackbarContent: { + ...makeOverrides(invertedTheme).MuiSnackbarContent, + root: { + ...makeOverrides(invertedTheme).MuiSnackbarContent.root, + backgroundColor: invertedTheme.palette.grey[200] + } } } diff --git a/react/Snackbar/Readme.md b/react/Snackbar/Readme.md index de3c8234cc..02702155ed 100644 --- a/react/Snackbar/Readme.md +++ b/react/Snackbar/Readme.md @@ -1 +1,81 @@ -Re-export of @material-ui. See [the official API](https://v4.mui.com/api/snackbar/). +```jsx +import Snackbar from 'cozy-ui/transpiled/react/Snackbar' +import Alert from 'cozy-ui/transpiled/react/Alert' +import Button from 'cozy-ui/transpiled/react/Buttons' +import CrossIcon from 'cozy-ui/transpiled/react/Icons/Cross' +import IconButton from 'cozy-ui/transpiled/react/IconButton' +import Typography from 'cozy-ui/transpiled/react/Typography' +import Icon from 'cozy-ui/transpiled/react/Icon' +import InfoIcon from 'cozy-ui/transpiled/react/Icons/Info' + +initialState = { open: isTesting() } + +const handleToggle = () => {setState(state => ({ open: !state.open }))} + +; + +<> +