From dfb0646d1b9fc3f63f17d0ef77ac8ae4c0ed8e69 Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Wed, 3 Jan 2024 11:16:13 -0500 Subject: [PATCH 1/7] fixing padding on Modal Header --- .../src/components/Modal/Modal.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/react-magma-dom/src/components/Modal/Modal.tsx b/packages/react-magma-dom/src/components/Modal/Modal.tsx index 69c76d94a..127e1d01e 100644 --- a/packages/react-magma-dom/src/components/Modal/Modal.tsx +++ b/packages/react-magma-dom/src/components/Modal/Modal.tsx @@ -160,6 +160,17 @@ const ModalContent = styled.div` } `; +const ModalHeader = styled.div<{ theme?: ThemeInterface }>` + padding: ${props => props.theme.spaceScale.spacing05} + ${props => props.theme.spaceScale.spacing05} 0 + ${props => props.theme.spaceScale.spacing05}; + @media (min-width: ${props => props.theme.breakpoints.small}px) { + padding: ${props => props.theme.spaceScale.spacing06} + ${props => props.theme.spaceScale.spacing06} 0 + ${props => props.theme.spaceScale.spacing06}; + } +`; + const ModalWrapper = styled.div<{ theme?: ThemeInterface }>` padding: ${props => props.theme.spaceScale.spacing05}; @media (min-width: ${props => props.theme.breakpoints.small}px) { @@ -366,7 +377,7 @@ export const Modal = React.forwardRef( theme={theme} > {header && ( - + {header && (

( {header}

)} -
+ )} {children} From 593f28e4913ec9c960791140a319ffefce8e97ee Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Wed, 3 Jan 2024 11:24:07 -0500 Subject: [PATCH 2/7] changey-set --- .changeset/fix-modalPadding.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-modalPadding.md diff --git a/.changeset/fix-modalPadding.md b/.changeset/fix-modalPadding.md new file mode 100644 index 000000000..dee3c756e --- /dev/null +++ b/.changeset/fix-modalPadding.md @@ -0,0 +1,5 @@ +--- +'react-magma-dom': minor +--- + +fix(Modal): Fixed bottom padding on the Modal header. From 99587e4bf777c6722ad435395ff8e05bb8a59301 Mon Sep 17 00:00:00 2001 From: ccedrone <77400920+ccedrone@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:35:50 -0500 Subject: [PATCH 3/7] Changing changeset description --- .changeset/fix-modalPadding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/fix-modalPadding.md b/.changeset/fix-modalPadding.md index dee3c756e..e9e70eede 100644 --- a/.changeset/fix-modalPadding.md +++ b/.changeset/fix-modalPadding.md @@ -1,5 +1,5 @@ --- -'react-magma-dom': minor +'react-magma-dom': patch --- fix(Modal): Fixed bottom padding on the Modal header. From 3c32ad037181d3082dfbd93798341e91f992a3cd Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Thu, 4 Jan 2024 09:16:52 -0500 Subject: [PATCH 4/7] Changing examples on docs and storybook to use Paragraph component --- .../src/components/Modal/Modal.stories.tsx | 81 ++++++++++--------- .../react-magma-docs/src/pages/api/modal.mdx | 79 +++++++++++------- 2 files changed, 93 insertions(+), 67 deletions(-) diff --git a/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx b/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx index 4608706b4..6682cd66e 100644 --- a/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx +++ b/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx @@ -9,6 +9,7 @@ import { DatePicker } from '../DatePicker'; import { ButtonGroup, ButtonGroupAlignment } from '../ButtonGroup'; import { Container } from '../Container'; import { NativeSelect } from '../NativeSelect'; +import { Paragraph } from '../Paragraph'; import { Spacer } from '../Spacer'; import { Combobox } from '../Combobox'; import { @@ -40,7 +41,7 @@ export const Default = () => { }} isOpen={showModal} > -

This is a modal, doing modal things.

+ This is a modal, doing modal things. @@ -70,11 +71,11 @@ export const LongContentWithScrolling = () => { return ( <> -

This is a modal, doing modal things.

-

+ This is a modal, doing modal things. + This is linked text in the modal -

-

+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut @@ -82,12 +83,12 @@ export const LongContentWithScrolling = () => { reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -

-

This is a modal, doing modal things.

-

+ + This is a modal, doing modal things. + This is some more linked text in the modal -

-

+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut @@ -95,12 +96,12 @@ export const LongContentWithScrolling = () => { reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -

-

This is a modal, doing modal things.

-

+ + This is a modal, doing modal things. + -

-

+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut @@ -108,7 +109,7 @@ export const LongContentWithScrolling = () => { reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -

+
{' '} -

+ )} @@ -248,11 +249,13 @@ export const NoHeaderOrFocusableContent = () => { onClose={onModalNoFocusClose} isOpen={showModalNoFocus} > -

This modal has no header and nothing focusable.

-

+ + This modal has no header and nothing focusable. + + Consider the usability implications before implementing a modal like this. A modal should have something actionable inside it. -

+ -

-

+ + This is some more linked text in the modal -

+ { ]} isClearable /> -

+ -

+ -

+ -

-

+ + This is some more linked text in the modal -

+
@@ -176,7 +188,7 @@ export function Example() { }} isOpen={showModalHeader} > -

This modal has no header.

+ This modal has no header. @@ -202,7 +214,7 @@ The close button can be hidden by using the `isCloseButtonHidden` prop. If this ```tsx import React from 'react'; -import { Button, Modal } from 'react-magma-dom'; +import { Button, Modal, Paragraph } from 'react-magma-dom'; export function Example() { const [showModal, setShowModal] = React.useState(false); const buttonRef = React.useRef(); @@ -218,7 +230,9 @@ export function Example() { }} isOpen={showModal} > -

The standard modal close button is hidden.

+ + The standard modal close button is hidden. + -

+ Magma Close Called Times: {magmaCloseCalledTimes} -

-

+ + Internal Close Called Times: {internalCloseCalledTimes} -

+ @@ -281,7 +295,13 @@ Although we don't recommend using nested modals, the ability for one nested moda ```tsx import React from 'react'; -import { Button, Modal, ModalSize, VisuallyHidden } from 'react-magma-dom'; +import { + Button, + Modal, + ModalSize, + Paragraph, + VisuallyHidden, +} from 'react-magma-dom'; export function Example() { const [showModal, setShowModal] = React.useState(false); const [showModal2, setShowModal2] = React.useState(false); @@ -295,7 +315,7 @@ export function Example() { }} isOpen={showModal} > -

This is a modal, doing modal things.

+ This is a modal, doing modal things. @@ -309,7 +329,7 @@ export function Example() { onClose={() => setShowModal2(false)} isOpen={showModal2} > -

This is modal 2

+ This is modal 2 ); @@ -324,6 +344,7 @@ import { Button, Hyperlink, Modal, + Paragraph, VisuallyHidden, Card, CardBody, @@ -343,24 +364,24 @@ export function Example() { isOpen={showModal} isInverse > -

This is a modal, doing modal things.

-

+ This is a modal, doing modal things. + This is{' '} linked text {' '} in the modal -

-

+ + -

-

+ + This is{' '} some more linked text {' '} in the modal -

+ From 45fc96ff73a50bb790ae0a9cf48e9a1a329a54c4 Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Thu, 4 Jan 2024 09:51:14 -0500 Subject: [PATCH 5/7] correcting prop name in Paragraph for docs --- .../react-magma-docs/src/pages/api/modal.mdx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website/react-magma-docs/src/pages/api/modal.mdx b/website/react-magma-docs/src/pages/api/modal.mdx index dc21a7916..c6900e4a0 100644 --- a/website/react-magma-docs/src/pages/api/modal.mdx +++ b/website/react-magma-docs/src/pages/api/modal.mdx @@ -46,7 +46,7 @@ export function Example() { return ( <> - This is a modal, doing modal things. + This is a modal, doing modal things. This is linked text in the modal @@ -99,7 +99,7 @@ export function Example() { }} isOpen={showSmallModal} > - + This is a small modal, doing small modal things. @@ -113,7 +113,7 @@ export function Example() { }} isOpen={showLargeModal} > - + This is a large modal, doing large modal things. @@ -174,7 +174,7 @@ export function Example() { }} isOpen={showModal} > - This modal has no header. + This modal has no header. @@ -188,7 +188,7 @@ export function Example() { }} isOpen={showModalHeader} > - This modal has no header. + This modal has no header. @@ -230,7 +230,7 @@ export function Example() { }} isOpen={showModal} > - + The standard modal close button is hidden. @@ -275,7 +275,7 @@ export function Example() { Lorem ipsum dolar sit amet - + Magma Close Called Times: {magmaCloseCalledTimes} @@ -315,7 +315,7 @@ export function Example() { }} isOpen={showModal} > - This is a modal, doing modal things. + This is a modal, doing modal things. @@ -364,7 +364,7 @@ export function Example() { isOpen={showModal} isInverse > - This is a modal, doing modal things. + This is a modal, doing modal things. This is{' '} From 53d0e1aa1d6deab9a0beecbe6eb984d68acbec12 Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Fri, 5 Jan 2024 11:04:02 -0500 Subject: [PATCH 6/7] tweaking examples for better aesthetics with new props --- .../src/components/Modal/Modal.stories.tsx | 17 +++++++++-------- .../react-magma-docs/src/pages/api/modal.mdx | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx b/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx index 6682cd66e..232207001 100644 --- a/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx +++ b/packages/react-magma-dom/src/components/Modal/Modal.stories.tsx @@ -41,7 +41,7 @@ export const Default = () => { }} isOpen={showModal} > - This is a modal, doing modal things. + This is a modal, doing modal things. @@ -71,7 +71,7 @@ export const LongContentWithScrolling = () => { return ( <> - This is a modal, doing modal things. + This is a modal, doing modal things. This is linked text in the modal @@ -185,7 +185,7 @@ export const ModalContentUpdate = () => {
{page === 1 && ( <> - Page one + Page one This is linked text in the modal @@ -203,6 +203,7 @@ export const ModalContentUpdate = () => { /> {showHidden && } + @@ -211,7 +212,7 @@ export const ModalContentUpdate = () => { {page === 2 && ( <> - Page two + Page two {' '} @@ -249,7 +250,7 @@ export const NoHeaderOrFocusableContent = () => { onClose={onModalNoFocusClose} isOpen={showModalNoFocus} > - + This modal has no header and nothing focusable. @@ -279,7 +280,7 @@ export const ModalInAModal = () => { }} isOpen={showModal} > - This is a modal, doing modal things. + This is a modal, doing modal things. This is linked text in the modal @@ -327,7 +328,7 @@ export const ModalInAModal = () => { onClose={() => setShowModal2(false)} isOpen={showModal2} > - This is modal 2 + This is modal 2 @@ -421,7 +422,7 @@ export const Inverse = () => { isOpen={showModal} isInverse > - + This is an inverse modal, doing modal things. diff --git a/website/react-magma-docs/src/pages/api/modal.mdx b/website/react-magma-docs/src/pages/api/modal.mdx index c6900e4a0..3aab44854 100644 --- a/website/react-magma-docs/src/pages/api/modal.mdx +++ b/website/react-magma-docs/src/pages/api/modal.mdx @@ -174,7 +174,7 @@ export function Example() { }} isOpen={showModal} > - This modal has no header. + This modal has no header. @@ -188,7 +188,7 @@ export function Example() { }} isOpen={showModalHeader} > - This modal has no header. + This modal has no header. @@ -230,7 +230,7 @@ export function Example() { }} isOpen={showModal} > - + The standard modal close button is hidden. @@ -329,7 +329,7 @@ export function Example() { onClose={() => setShowModal2(false)} isOpen={showModal2} > - This is modal 2 + This is modal 2 ); From 451d8f8f61b66bc52de1027efd0dbf783c965cda Mon Sep 17 00:00:00 2001 From: Chris Cedrone Date: Fri, 5 Jan 2024 11:39:55 -0500 Subject: [PATCH 7/7] more example tweaks --- website/react-magma-docs/src/pages/api/modal.mdx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/website/react-magma-docs/src/pages/api/modal.mdx b/website/react-magma-docs/src/pages/api/modal.mdx index 3aab44854..7135a58f0 100644 --- a/website/react-magma-docs/src/pages/api/modal.mdx +++ b/website/react-magma-docs/src/pages/api/modal.mdx @@ -315,7 +315,7 @@ export function Example() { }} isOpen={showModal} > - This is a modal, doing modal things. + This is a modal, doing modal things. @@ -364,18 +364,20 @@ export function Example() { isOpen={showModal} isInverse > - This is a modal, doing modal things. - + + This is a modal, doing modal things. + + This is{' '} linked text {' '} in the modal - + - + This is{' '} some more linked text