diff --git a/CHANGELOG.md b/CHANGELOG.md index 2900c9d47..d148ab3ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Not released +- Improve styles for MaterialUI Dialog component [#272](https://github.com/CartoDB/carto-react/pull/272) + ## 1.2 ### 1.2.1-alpha.5 (2022-01-20) diff --git a/packages/react-ui/src/theme/carto-theme.js b/packages/react-ui/src/theme/carto-theme.js index fda65f200..8ef6dee5f 100644 --- a/packages/react-ui/src/theme/carto-theme.js +++ b/packages/react-ui/src/theme/carto-theme.js @@ -1327,6 +1327,9 @@ export const cartoThemeOptions = { MuiSlider: { color: 'primary', marks: false + }, + MuiDialog: { + maxWidth: 'md' } } }; diff --git a/packages/react-ui/storybook/stories/common/Dialog.stories.js b/packages/react-ui/storybook/stories/common/Dialog.stories.js index b99f59c67..6fe6481c7 100644 --- a/packages/react-ui/storybook/stories/common/Dialog.stories.js +++ b/packages/react-ui/storybook/stories/common/Dialog.stories.js @@ -8,16 +8,50 @@ import { DialogActions, FormGroup, Grid, + Slide, TextField } from '@material-ui/core'; const options = { title: 'Common/Dialog', - component: Dialog + component: Dialog, + argTypes: { + disableEscapeKeyDown: { + description: 'If `true`, hitting escape will not fire the `onClose` callback.', + defaultValue: false, + control: { + type: 'boolean' + } + }, + fullScreen: { + description: 'If `true`, the dialog will be full-screen', + defaultValue: false, + control: { + type: 'boolean' + } + }, + fullWidth: { + description: + 'If `true`, the dialog stretches to `maxWidth`. Notice that the dialog width grow is limited by the default margin.', + defaultValue: false, + control: { + type: 'boolean' + } + }, + maxWidth: { + description: + 'Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`.', + defaultValue: 'md', + control: { + type: 'select', + options: ['lg', 'md', 'sm', 'xl', 'xs', false] + } + } + } }; export default options; -const Template = ({ content, ...args }) => { +const Template = ({ content = , ...args }) => { const [open, setOpen] = React.useState(false); const handleClickOpen = () => { @@ -31,16 +65,16 @@ const Template = ({ content, ...args }) => { return (
- Dialog title + Dialog title {content}