diff --git a/e2e/__tests__/__image_snapshots__/dialog-test-js-components-dialog-with-stretch-1-snap.png b/e2e/__tests__/__image_snapshots__/dialog-test-js-components-dialog-with-stretch-1-snap.png new file mode 100644 index 00000000..253040d3 Binary files /dev/null and b/e2e/__tests__/__image_snapshots__/dialog-test-js-components-dialog-with-stretch-1-snap.png differ diff --git a/e2e/__tests__/dialog.test.js b/e2e/__tests__/dialog.test.js index d2e2a267..eb16360d 100644 --- a/e2e/__tests__/dialog.test.js +++ b/e2e/__tests__/dialog.test.js @@ -5,8 +5,14 @@ const SUITES = [ baisy.suite('Components/Dialog', 'default') .setRoot(async (iframe) => { return await iframe.waitForXPath('//*[@data-e2e-id="default-dialog"]'); - }), + }) + , baisy.suite('Components/Dialog', 'with scroll') + .setRoot(async (iframe) => { + return await iframe.waitForXPath('//*[@data-e2e-id="default-dialog"]'); + }) + , + baisy.suite('Components/Dialog', 'with stretch') .setRoot(async (iframe) => { return await iframe.waitForXPath('//*[@data-e2e-id="default-dialog"]'); }), diff --git a/src/components/Dialog/Dialog.js b/src/components/Dialog/Dialog.js index 198c2ba6..d34dab39 100644 --- a/src/components/Dialog/Dialog.js +++ b/src/components/Dialog/Dialog.js @@ -9,7 +9,7 @@ import { DialogFooter } from './DialogFooter'; import { DialogHeader } from './DialogHeader'; import { DialogTag, DialogInnerTag } from './Dialog.theme'; -type DialogPlateProps = { +type DialogProps = { children?: React$Node, isOpen?: boolean, onClose?: (any) => void, @@ -18,6 +18,7 @@ type DialogPlateProps = { shouldCloseOnEscPress ?: boolean, padding?: PropSizes, tagName?: string, + stretch?: boolean, }; @@ -33,8 +34,9 @@ const Dialog = ({ args, padding, tagName, + stretch, ...rest - }: DialogPlateProps) => { + }: DialogProps) => { return ( { ({ args, onClose }) => ( - - + + { typeof children === 'function' - ? (args) => { children(args) } - : { children } + ? (args) => { children(args) } + : { children } } diff --git a/src/components/Dialog/Dialog.stories.js b/src/components/Dialog/Dialog.stories.js index 00ac46f8..8098d4ee 100644 --- a/src/components/Dialog/Dialog.stories.js +++ b/src/components/Dialog/Dialog.stories.js @@ -17,6 +17,20 @@ export default (asStory) => { )) + .add('with stretch', () => ( + + + + + Fagelia cancrivorous Nahor Curucaneca Echinocaris intrafissural glassful agronomics + + + + + + + + )) .add('with large size', () => ( diff --git a/src/components/Dialog/Dialog.theme.js b/src/components/Dialog/Dialog.theme.js index aa5f7a3a..d19ae512 100644 --- a/src/components/Dialog/Dialog.theme.js +++ b/src/components/Dialog/Dialog.theme.js @@ -8,6 +8,7 @@ const [DialogBodyTag, themeBody] = createThemeTag('dialogBody', { display: 'flex', flexDirection: 'column', flexShrink: 1, + flexGrow: 1, maxHeight: '100%', }, }); @@ -37,6 +38,9 @@ const [DialogTag, themeDialog] = createThemeTag('dialog', { flex: '0 1 90%', }, modifiers: { + stretch: { + height: '100%', + }, size: { xs: { width: '300px', @@ -66,7 +70,12 @@ const [DialogInnerTag, themeDialogInner] = createThemeTag('dialogInner', { '&, & > form': { display: 'flex', flexDirection: 'column', - justifyContent: 'center', + justifyContent: 'flex-start', + }, + }, + modifiers: { + stretch: { + height: '100%', }, }, });