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: Use semantic Heading for the title of a Dialog #1123

Merged
merged 8 commits into from
Mar 14, 2024
18 changes: 1 addition & 17 deletions packages/css/src/components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

@import "../../common/breakpoint";
@import "../../common/hyphenation";

.ams-dialog {
background-color: var(--ams-dialog-background-color);
Expand Down Expand Up @@ -44,22 +43,7 @@
align-items: flex-start;
display: flex;
gap: var(--ams-dialog-header-gap);
}

@mixin reset {
-webkit-text-size-adjust: 100%;
}

.ams-dialog__title {
color: var(--ams-dialog-title-color);
flex: auto;
font-family: var(--ams-dialog-title-font-family);
font-size: var(--ams-dialog-title-font-size);
font-weight: var(--ams-dialog-title-font-weight);
line-height: var(--ams-dialog-title-line-height);

@include hyphenation;
@include reset;
justify-content: space-between;
}

.ams-dialog__footer {
Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import clsx from 'clsx'
import { forwardRef } from 'react'
import type { DialogHTMLAttributes, ForwardedRef, PropsWithChildren, ReactNode } from 'react'
import { Heading } from '../Heading'
import { IconButton } from '../IconButton'

export type DialogProps = {
Expand All @@ -17,8 +18,8 @@ export const Dialog = forwardRef(
<dialog {...restProps} ref={ref} className={clsx('ams-dialog', className)}>
<form method="dialog" className="ams-dialog__form">
<header className="ams-dialog__header">
<span className="ams-dialog__title">{title}</span>
<IconButton label="Sluiten" formNoValidate />
<Heading size="level-4">{title}</Heading>
<IconButton formNoValidate label="Sluiten" size="level-4" />
</header>
<article className="ams-dialog__article">{children}</article>
{actions && <footer className="ams-dialog__footer">{actions}</footer>}
Expand Down
7 changes: 0 additions & 7 deletions proprietary/tokens/src/components/ams/dialog.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
"background-color": { "value": "{ams.color.primary-white}" },
"border": { "value": "0" },
"max-inline-size": { "value": "min(87.69vw, 45rem)" },
"title": {
"color": { "value": "{ams.color.primary-black}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.bold}" },
"line-height": { "value": "{ams.text.level.5.line-height}" }
},
"form": {
"gap": { "value": "1.5rem" },
"padding-block": { "value": "clamp(1.5rem, calc(1.5rem + ((1vw - 0.5337rem) * 2.1448)), 2.5rem)" },
Expand Down
Loading