Skip to content

Commit

Permalink
feat: rename data-ds-typography to data-typography (#2959)
Browse files Browse the repository at this point in the history
resolves #2899
  • Loading branch information
Barsnes authored Jan 8, 2025
1 parent 19134ea commit dc6ab52
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .changeset/olive-windows-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet": patch
"@digdir/designsystemet-theme": patch
---

Rename `data-ds-typography` to `data-typography`
2 changes: 1 addition & 1 deletion apps/storybook/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<style>
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap');

[data-ds-typography='secondary'] {
[data-typography='secondary'] {
font-family: var(--ds-font-family), monospace;
}
</style>
4 changes: 2 additions & 2 deletions apps/storybook/stories/showcase.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const ShowcaseStory: StoryFn = () => {
<Fieldset>
<Fieldset.Legend>
Typografi
<code data-size='xs'>(data-ds-typography)</code>
<code data-size='xs'>(data-typography)</code>
</Fieldset.Legend>
<ToggleGroup value={typographyMode} onChange={setTypographyMode}>
{typography.map((typographyMode) => (
Expand All @@ -74,7 +74,7 @@ export const ShowcaseStory: StoryFn = () => {
<Showcase
data-size={size}
data-color-scheme={colorMode}
data-ds-typography={typographyMode}
data-typography={typographyMode}
/>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/tokens/build/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const typescriptTokens: GetStyleDictionaryConfig = ({ 'color-scheme': colorSchem
};

const typographyVariables: GetStyleDictionaryConfig = ({ theme, typography }, { outPath }) => {
const selector = `${typography === 'primary' ? ':root, ' : ''}[data-ds-typography="${typography}"]`;
const selector = `${typography === 'primary' ? ':root, ' : ''}[data-typography="${typography}"]`;
const layer = `ds.theme.typography.${typography}`;

return {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/stories/bruk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Dersom `auto` er valgt, vil fargemodusen endres basert på brukerens preferanser
[prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme).

<br />
#### `data-ds-typography`
#### `data-typography`

Brukes til å endre typografien på komponentene. Mulige verdier er `primary` og `secondary`.
Et vanlig bruksområde for denne attributten er når du ønsker en monospace font på tabeller.
Expand All @@ -142,12 +142,12 @@ Dette kan løses ved å f.eks bruke [attribute selector](https://developer.mozil
<CodeSnippet language='html'>
{`
<style>
[data-ds-typography='secondary'] {
[data-typography='secondary'] {
font-family: var(--ds-font-family), monospace;
}
</style>
<table
data-ds-typography='secondary'
data-typography='secondary'
>
</table>
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/brand/altinn.css
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down Expand Up @@ -1152,7 +1152,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Helvetica Neue;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 700;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/altinn/typography/primary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Helvetica Neue;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 700;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/altinn/typography/secondary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/brand/digdir.css
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down Expand Up @@ -1152,7 +1152,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/digdir/typography/primary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/digdir/typography/secondary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/brand/portal.css
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down Expand Up @@ -1152,7 +1152,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/portal/typography/primary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/portal/typography/secondary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/brand/uutilsynet.css
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down Expand Up @@ -1152,7 +1152,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/uutilsynet/typography/primary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.primary {
:root, [data-ds-typography="primary"] {
:root, [data-typography="primary"] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/brand/uutilsynet/typography/secondary.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography="secondary"] {
[data-typography="secondary"] {
--ds-font-family: IBM Plex Mono;
--ds-font-weight-medium: 400;
--ds-font-weight-semibold: 700;
Expand Down
4 changes: 2 additions & 2 deletions plugins/figma/src/ui/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@
*/

@layer ds.theme.typography.secondary {
[data-ds-typography='secondary'] {
[data-typography='secondary'] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down Expand Up @@ -1787,7 +1787,7 @@

@layer ds.theme.typography.primary {
:root,
[data-ds-typography='primary'] {
[data-typography='primary'] {
--ds-font-family: Inter;
--ds-font-weight-medium: 500;
--ds-font-weight-semibold: 600;
Expand Down

0 comments on commit dc6ab52

Please sign in to comment.