From 1f74af90dcc52e20ce7b0383169077dc42ef247c Mon Sep 17 00:00:00 2001 From: JF-Cozy Date: Fri, 24 Jun 2022 16:00:17 +0200 Subject: [PATCH] feat(Alert): Add new Alert and AlertTitle components --- docs/styleguide.config.js | 2 + package.json | 2 + react/Alert/Readme.md | 89 ++++++++++++++++++++++++ react/Alert/index.jsx | 103 ++++++++++++++++++++++++++++ react/AlertTitle/Readme.md | 1 + react/AlertTitle/index.jsx | 3 + react/MuiCozyTheme/makeOverrides.js | 68 +++++++++++++++++- react/examples.spec.jsx | 1 + react/index.js | 2 + yarn.lock | 20 ++++++ 10 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 react/Alert/Readme.md create mode 100644 react/Alert/index.jsx create mode 100644 react/AlertTitle/Readme.md create mode 100644 react/AlertTitle/index.jsx diff --git a/docs/styleguide.config.js b/docs/styleguide.config.js index eab63e42db..70f09deee0 100644 --- a/docs/styleguide.config.js +++ b/docs/styleguide.config.js @@ -136,6 +136,8 @@ module.exports = { { name: 'Special', components: () => [ + '../react/Alert/index.jsx', + '../react/AlertTitle/index.jsx', '../react/Alerter/index.jsx', '../react/AppIcon/index.jsx', '../react/AppTile/index.jsx', diff --git a/package.json b/package.json index 5f2a07149b..7342e451fa 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@babel/helper-regex": "7.10.5", "@cozy/codemods": "^1.9.0", "@material-ui/core": "4.12.3", + "@material-ui/lab": "4.0.0-alpha.61", "@semantic-release/changelog": "5.0.1", "@semantic-release/git": "7.0.18", "@semantic-release/npm": "9.0.1", @@ -173,6 +174,7 @@ }, "peerDependencies": { "@material-ui/core": ">=4.12", + "@material-ui/lab": ">=4.0.0-alpha.61", "cozy-client": ">=28.1.0", "cozy-device-helper": "^2.0.0", "cozy-doctypes": "^1.69.0", diff --git a/react/Alert/Readme.md b/react/Alert/Readme.md new file mode 100644 index 0000000000..2fdd7b5ab0 --- /dev/null +++ b/react/Alert/Readme.md @@ -0,0 +1,89 @@ +```jsx +import Alert from 'cozy-ui/transpiled/react/Alert' +import AlertTitle from 'cozy-ui/transpiled/react/AlertTitle' +import Button from 'cozy-ui/transpiled/react/Buttons' +import Icon from 'cozy-ui/transpiled/react/Icon' +import Variants from 'cozy-ui/docs/components/Variants' +import DeviceLaptopIcon from 'cozy-ui/transpiled/react/Icons/DeviceLaptop' +import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download' + +const initialVariants = [{ + longText: false, + title: false, + block: false, + color: false, + icon: false, + square: false, + actionOne: false, + actionTwo: false, + close: false +}] + +; + + + {variant => ( + } + action={(variant.actionOne || variant.actionTwo) ? + <> + {variant.actionOne && +