From 429769d2f7ace5de9754d4b39b9b9e83a5a80d66 Mon Sep 17 00:00:00 2001 From: builtbyedgar Date: Wed, 12 Jan 2022 09:57:03 +0100 Subject: [PATCH 1/4] dialog component wip --- packages/react-ui/src/theme/carto-theme.js | 6 ++ .../stories/common/Dialog.stories.js | 63 +++++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/packages/react-ui/src/theme/carto-theme.js b/packages/react-ui/src/theme/carto-theme.js index fda65f200..86e4dfaef 100644 --- a/packages/react-ui/src/theme/carto-theme.js +++ b/packages/react-ui/src/theme/carto-theme.js @@ -1327,6 +1327,12 @@ export const cartoThemeOptions = { MuiSlider: { color: 'primary', marks: false + }, + MuiDialog: { + disableEscapeKeyDown: false, + fullScreen: false, + fullWidth: false, + maxWidth: 'sm' } } }; diff --git a/packages/react-ui/storybook/stories/common/Dialog.stories.js b/packages/react-ui/storybook/stories/common/Dialog.stories.js index b99f59c67..517c81b42 100644 --- a/packages/react-ui/storybook/stories/common/Dialog.stories.js +++ b/packages/react-ui/storybook/stories/common/Dialog.stories.js @@ -1,4 +1,5 @@ import React from 'react'; +import { Meta } from '@storybook/react'; import { Button, Dialog, @@ -8,12 +9,46 @@ 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; @@ -31,16 +66,16 @@ const Template = ({ content, ...args }) => { return (
- Dialog title + Dialog title {content}