Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Modal): api alignment #2440

Merged
merged 26 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b494ffc
fix(Modal): start api alignment
eirikbacker Sep 17, 2024
8dfb87c
fix(Modal): fix semantics
eirikbacker Sep 17, 2024
39ca25e
fix(Modal): prevent useeffect running on every render
eirikbacker Sep 18, 2024
62b7bc3
fix build of storybook
Barsnes Sep 18, 2024
9cfa0d2
temp turn off some tests
Barsnes Sep 18, 2024
d692bac
Merge branch 'next' into fix/modal-api
eirikbacker Sep 19, 2024
d6ef560
fix(Modal): update header and footer design and backdrop close
eirikbacker Sep 23, 2024
f1d13ea
Merge branch 'next' into fix/modal-api
eirikbacker Sep 23, 2024
61760a7
chore(Modal): update tokens modal
eirikbacker Sep 23, 2024
be0884b
docs(Modal): update comobobox story
eirikbacker Sep 23, 2024
2849ced
Merge branch 'next' into fix/modal-api
eirikbacker Sep 23, 2024
9c88691
fix(Modal): remove reduntant css custom properties
eirikbacker Sep 23, 2024
26f69fa
docs(Modal): remove redundant oninteractionoutside
eirikbacker Sep 23, 2024
b76cb0d
fix(Modal): remove redundant hr styling
eirikbacker Sep 23, 2024
38166cd
Update packages/react/src/components/Modal/Modal.mdx
eirikbacker Sep 24, 2024
ca6adbe
Update packages/react/src/components/Modal/Modal.mdx
eirikbacker Sep 24, 2024
636cdd8
Update packages/react/src/components/Modal/Modal.mdx
eirikbacker Sep 24, 2024
be71bc6
Update packages/react/src/components/Modal/Modal.mdx
eirikbacker Sep 24, 2024
8dfaace
Merge branch 'next' into fix/modal-api
eirikbacker Sep 24, 2024
81f7b25
fix(Modal): pr review
eirikbacker Sep 24, 2024
76b0362
docs(Modal): update story args
eirikbacker Sep 24, 2024
f307eec
Update packages/react/src/components/Modal/Modal.stories.tsx
eirikbacker Sep 25, 2024
a78e993
docs(Modal): cleanup
eirikbacker Sep 25, 2024
a1bcec8
Create hip-schools-greet.md
eirikbacker Sep 25, 2024
96c7167
Merge branch 'next' into fix/modal-api
eirikbacker Sep 25, 2024
42fe976
fix(Modal): rename closeLabel to closeButton
eirikbacker Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/hip-schools-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@digdir/designsystemet-css": patch
"@digdir/designsystemet-react": patch
---

Modal:
- Rename `Modal.Dialog` to `Modal`
- Rename `Modal.Root` to `Modal.Context`
- Replace `onInteractOutside` event with `backdropClose` boolean
- Replace `closeButton` and `closeButtonTitle` on `Modal.Header` with `closeButton` on `Modal`
- Add border to `Modal.Header` and `Modal.Footer`
- Remove `Modal.Content`
- Remove `onBeforeClose`
- Remove `subtitle` from `Modal.Header`
13 changes: 6 additions & 7 deletions apps/_components/src/ColorModal/ColorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,17 @@ export const ColorModal = ({
weight,
}: ColorModalProps) => {
return (
<Modal.Root>
<Modal.Dialog
<Modal.Context>
<Modal
ref={colorModalRef}
style={{
maxWidth: '1050px',
}}
onInteractOutside={() => colorModalRef.current?.close()}
>
<Modal.Header>
{`${capitalizeFirstLetter(namespace)} ${capitalizeFirstLetter(getColorNameFromNumber(weight))}`}
</Modal.Header>
<Modal.Content className={classes.modalContent}>
<div className={classes.modalContent}>
<div className={classes.description}>
{getColorDescription({
weight,
Expand Down Expand Up @@ -121,8 +120,8 @@ export const ColorModal = ({
</Accordion.Content>
</Accordion.Item>
</Accordion.Root> */}
</Modal.Content>
</Modal.Dialog>
</Modal.Root>
</div>
</Modal>
</Modal.Context>
);
};
11 changes: 1 addition & 10 deletions apps/theme/components/TokenModal/TokenModal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
padding-right: 0;
}

.modalContent {
padding-bottom: 24px;
}

.tabs {
margin-bottom: 16px;
}
Expand All @@ -34,7 +30,7 @@
margin-bottom: 16px;
}

.modalHeader h2 {
.modalHeader {
display: flex;
align-items: center;
justify-content: space-between;
Expand All @@ -55,11 +51,6 @@
font-weight: 500;
}

.modalHeader > button {
right: 22px;
top: 22px;
}

.hiddenGlobalBtn {
position: absolute;
left: 0;
Expand Down
167 changes: 81 additions & 86 deletions apps/theme/components/TokenModal/TokenModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,107 +69,102 @@ export const TokenModal = ({
}, []);

return (
<Modal.Root>
<Modal.Context>
<Modal.Trigger
onClick={() => {
return modalRef.current?.showModal();
}}
>
Ta i bruk tema
</Modal.Trigger>
<Modal.Dialog
ref={modalRef}
onInteractOutside={() => modalRef.current?.close()}
style={{
maxWidth: '1400px',
}}
<Modal
className={classes.modal}
style={{ maxWidth: 1400 }}
ref={modalRef}
>
<Modal.Header className={classes.modalHeader}>
<Heading className={classes.modalHeader} size='xs' spacing>
<img src='img/emblem.svg' alt='' className={classes.emblem} />
<span className={classes.headerText}>Kopier fargetema</span>
</Modal.Header>
<Modal.Content className={classes.modalContent}>
<Ingress size='xs' spacing>
Velg et av alternativene under for å ta i bruk design-tokens med
ditt tema.
</Ingress>
<Heading level={3} size='xs' spacing>
Alt 1. Design tokens
</Heading>
<Textfield
label='Navn på tema'
description="Kun bokstaver, tall og bindestrek. Eks: 'mitt-tema'"
value={themeName}
onChange={(e) => {
const value = e.currentTarget.value
.replace(/\s+/g, '-')
.replace(/[^A-Z0-9-]+/gi, '')
.toLowerCase();
</Heading>
<Ingress size='xs' spacing>
Velg et av alternativene under for å ta i bruk design-tokens med ditt
tema.
</Ingress>
<Heading level={3} size='xs' spacing>
Alt 1. Design tokens
</Heading>
<Textfield
label='Navn på tema'
description="Kun bokstaver, tall og bindestrek. Eks: 'mitt-tema'"
value={themeName}
onChange={(e) => {
const value = e.currentTarget.value
.replace(/\s+/g, '-')
.replace(/[^A-Z0-9-]+/gi, '')
.toLowerCase();

setThemeName(value);
}}
style={{ marginBlock: 'var(--ds-spacing-4)' }}
></Textfield>
<Paragraph spacing>
Kopier kommandosnutten under og kjør på maskinen din for å generere
alle design tokens (json-filer). Sørg for at du har{' '}
<Link href='https://nodejs.org' target='_blank'>
Node.js (åpnes i ny fane)
</Link>{' '}
installert på maskinen din.
</Paragraph>
<div
className={classes.snippet}
style={{ marginBottom: 'var(--ds-spacing-8)' }}
setThemeName(value);
}}
style={{ marginBlock: 'var(--ds-spacing-4)' }}
/>
<Paragraph spacing>
Kopier kommandosnutten under og kjør på maskinen din for å generere
alle design tokens (json-filer). Sørg for at du har{' '}
<Link href='https://nodejs.org' target='_blank'>
Node.js (åpnes i ny fane)
</Link>{' '}
installert på maskinen din.
</Paragraph>
<div
className={classes.snippet}
style={{ marginBottom: 'var(--ds-spacing-8)' }}
>
<CodeSnippet syntax='shell'>{cliSnippet}</CodeSnippet>
</div>
<Heading level={3} size='xs' spacing>
Alt 2. Figma plugin
</Heading>
<Paragraph spacing>
JSON for bruk med Designsystemet{' '}
<Link
href='https://www.figma.com/community/plugin/1382044395533039221/designsystemet-beta'
target='_blank'
>
<CodeSnippet syntax='shell'>{cliSnippet}</CodeSnippet>
</div>
<Heading level={3} size='xs' spacing>
Alt 2. Figma plugin
</Heading>
<Paragraph spacing>
JSON for bruk med Designsystemet{' '}
<Link
href='https://www.figma.com/community/plugin/1382044395533039221/designsystemet-beta'
target='_blank'
>
Figma Plugin (åpnes i ny fane)
</Link>{' '}
og{' '}
<Link
href='https://www.figma.com/community/file/1322138390374166141/designsystemet-core-ui-kit'
target='_blank'
>
Figma UI kit (åpnes i ny fane)
</Link>
.
</Paragraph>
<Paragraph spacing>
Dette alternativet er kun ment for rask prototyping av valgt tema i
Figma. For å bruke design tokens i produksjon, anbefales det å bruke
alternativ 1.
</Paragraph>
<div className={classes.content}>
<div className={classes.column}>
<Heading level={4} size='2xs' spacing>
Light Mode
</Heading>
<div className={classes.snippet}>
<CodeSnippet language='json'>{lightThemeSnippet}</CodeSnippet>
</div>
Figma Plugin (åpnes i ny fane)
</Link>{' '}
og{' '}
<Link
href='https://www.figma.com/community/file/1322138390374166141/designsystemet-core-ui-kit'
target='_blank'
>
Figma UI kit (åpnes i ny fane)
</Link>
.
</Paragraph>
<Paragraph spacing>
Dette alternativet er kun ment for rask prototyping av valgt tema i
Figma. For å bruke design tokens i produksjon, anbefales det å bruke
alternativ 1.
</Paragraph>
<div className={classes.content}>
<div className={classes.column}>
<Heading level={4} size='2xs' spacing>
Light Mode
</Heading>
<div className={classes.snippet}>
<CodeSnippet language='json'>{lightThemeSnippet}</CodeSnippet>
</div>
<div className={classes.column}>
<Heading level={4} size='2xs' spacing>
Dark Mode
</Heading>
<div className={classes.snippet}>
<CodeSnippet language='json'>{darkThemeSnippet}</CodeSnippet>
</div>
</div>
<div className={classes.column}>
<Heading level={4} size='2xs' spacing>
Dark Mode
</Heading>
<div className={classes.snippet}>
<CodeSnippet language='json'>{darkThemeSnippet}</CodeSnippet>
</div>
</div>
</Modal.Content>
</Modal.Dialog>
</Modal.Root>
</div>
</Modal>
</Modal.Context>
);
};
Loading
Loading