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

Large VW tokens naar apart css bestand schrijven #772

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .changeset/update-nora-design-tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@nl-design-system-community/nora-design-tokens": minor
---

feat: set underline tokens to none
feat: change utrecht-heading tokens
feat: add nora-page-layout tokens
feat: add nora-page-section tokens
feat: add large-vw tokens to separate files
fix: change link in index.scss
159 changes: 142 additions & 17 deletions proprietary/nora-design-tokens/figma/figma.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,18 @@
"$type": "fontFamilies",
"$value": "\"Fira Code\", Tahoma, Verdana, sans-serif"
}
},
"heading": {
"scale": {
"$type": "number",
"$value": "1.15"
},
"large-vw": {
"scale": {
"$type": "number",
"$value": "1.2"
}
}
}
},
"border-radius": {
Expand Down Expand Up @@ -607,6 +619,14 @@
"type": "dropShadow"
}
}
},
"breakpoint": {
"large-vw": {
"min-width": {
"$type": "dimension",
"$value": "64rem"
}
}
}
}
},
Expand Down Expand Up @@ -677,7 +697,7 @@
},
"color": {
"$type": "color",
"$value": "{nora.color.black}"
"$value": "{nora.document.color}"
}
},
"form-control": {
Expand Down Expand Up @@ -1069,6 +1089,10 @@
"$type": "sizing",
"$value": "45.25rem"
}
},
"no-text-decoration": {
"$type": "textDecoration",
"$value": "none"
}
}
},
Expand Down Expand Up @@ -1121,7 +1145,7 @@
},
"text-decoration": {
"$type": "textDecoration",
"$value": "None"
"$value": "{nora.no-text-decoration}"
}
},
"focus": {
Expand All @@ -1135,7 +1159,7 @@
},
"text-decoration": {
"$type": "textDecoration",
"$value": "None"
"$value": "{nora.no-text-decoration}"
}
},
"hover": {
Expand All @@ -1145,7 +1169,7 @@
},
"text-decoration": {
"$type": "textDecoration",
"$value": "None"
"$value": "{nora.no-text-decoration}"
}
},
"current": {
Expand All @@ -1156,7 +1180,7 @@
},
"text-decoration": {
"$type": "textDecoration",
"$value": "none"
"$value": "{nora.no-text-decoration}"
}
},
"separator": {
Expand Down Expand Up @@ -1441,12 +1465,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.2xl}"
"$value": "{utrecht.heading-2.font-size} * {nora.typography.heading.scale}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.3xl}"
"$value": "{utrecht.heading-2.large-vw.font-size} * {nora.typography.heading.large-vw.scale}"
}
}
},
Expand All @@ -1469,12 +1493,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.xl}"
"$value": "{utrecht.heading-3.font-size} * {nora.typography.heading.scale}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.2xl}"
"$value": "{utrecht.heading-3.large-vw.font-size} * {nora.typography.heading.large-vw.scale}"
}
}
},
Expand All @@ -1497,12 +1521,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.lg}"
"$value": "{utrecht.heading-4.font-size} * {nora.typography.heading.scale}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.xl}"
"$value": "{utrecht.heading-4.large-vw.font-size} * {nora.typography.heading.large-vw.scale}"
}
}
},
Expand All @@ -1525,12 +1549,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.md}"
"$value": "{utrecht.heading-5.font-size} * {nora.typography.heading.scale}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.lg}"
"$value": "{utrecht.heading-5.large-vw.font-size} * {nora.typography.heading.large-vw.scale}"
}
}
},
Expand All @@ -1553,12 +1577,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.sm}"
"$value": "{nora.document.font-size}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.md}"
"$value": "{nora.document.large-vw.font-size}"
}
}
},
Expand All @@ -1581,12 +1605,12 @@
},
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.sm}"
"$value": "{nora.document.font-size}"
},
"large-vw": {
"font-size": {
"$type": "fontSizes",
"$value": "{nora.typography.font-size.md}"
"$value": "{nora.document.large-vw.font-size}"
}
}
}
Expand Down Expand Up @@ -2166,6 +2190,105 @@
}
}
},
"components/page-section": {
"nora": {
"page-section": {
"article": {
"padding-block-start": {
"$type": "dimension",
"$value": "{nora.space.300}"
},
"padding-block-end": {
"$type": "dimension",
"$value": "{nora.space.300}"
},
"padding-inline-start": {
"$type": "dimension",
"$value": "{nora.space.200}"
},
"padding-inline-end": {
"$type": "dimension",
"$value": "{nora.space.200}"
},
"container": {
"gap": {
"$type": "dimension",
"$value": "{nora.space.300}"
},
"large-vw": {
"gap": {
"$type": "dimension",
"$value": "4rem"
},
"min-width": {
"$type": "dimension",
"$value": "61.5rem"
},
"max-width": {
"$type": "dimension",
"$value": "72rem"
}
}
},
"large-vw": {
"padding-block-start": {
"$type": "dimension",
"$value": "{nora.space.600}"
},
"padding-block-end": {
"$type": "dimension",
"$value": "{nora.space.600}"
},
"padding-inline-start": {
"$type": "dimension",
"$value": "{nora.space.250}"
},
"padding-inline-end": {
"$type": "dimension",
"$value": "{nora.space.250}"
}
},
"content": {
"large-vw": {
"min-width": {
"$type": "dimension",
"$value": "40rem",
"$description": "640px"
},
"max-width": {
"$type": "dimension",
"$value": "46rem",
"$description": "736px"
}
}
},
"navigation": {
"large-vw": {
"max-width": {
"$type": "dimension",
"$value": "22rem",
"$description": "352px"
}
}
}
}
}
}
},
"components/page-layout": {
"nora": {
"page-layout": {
"scrolled": {
"header-container": {
"box-shadow": {
"$type": "boxShadow",
"$value": "{nora.box-shadow.sm}"
}
}
}
}
}
},
"components/unordered-list": {
"utrecht": {
"unordered-list": {
Expand Down Expand Up @@ -2403,6 +2526,8 @@
"components/navigation-bar",
"components/ordered-list",
"components/paragraph",
"components/page-section",
"components/page-layout",
"components/unordered-list",
"drafts/breadcrumbs-tools-bar",
"drafts/link-overview",
Expand Down
2 changes: 1 addition & 1 deletion proprietary/nora-design-tokens/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* All rights reserved
*/

@import "./design-tokens.css";
@import "./theme.css";
48 changes: 47 additions & 1 deletion proprietary/nora-design-tokens/style-dictionary.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { typeDtcgDelegate } from 'style-dictionary/utils';
import { readFile } from 'node:fs/promises';
import { createConfig } from '../../style-dictionary-config.js';

const isLargeVwToken = (token) => {
return token.path && token.path.includes('large-vw');
};

const build = async () => {
const themeConfig = JSON.parse(await readFile('./src/config.json', 'utf-8'));
StyleDictionary.registerPreprocessor({
Expand All @@ -15,14 +19,56 @@ const build = async () => {
excludeParentKeys: true,
});

const themeSelector = `.${themeConfig.prefix}-theme`;

const sd = new StyleDictionary({
...createConfig({
selector: `.${themeConfig.prefix}-theme`,
selector: themeSelector,
}),
preprocessors: ['tokens-studio', 'dtcg-delegate'],
source: ['figma/**/*.tokens.json'],
});

sd.registerFilter({
name: 'filter-large-vw',
filter: isLargeVwToken,
});

sd.registerTransform({
name: 'name/remove-large-vw',
type: 'name',
filter: isLargeVwToken,
transform: (token) => {
return token.name.replace(/-large-vw/g, '');
},
});

sd.platforms.largeCss = {
transformGroup: 'tokens-studio',
transforms: ['name/kebab', 'name/remove-large-vw'],
buildPath: 'dist/',
files: [
{
destination: 'theme-large-vw.css',
format: 'css/variables',
filter: 'filter-large-vw',
options: {
selector: themeSelector,
outputReferences: true,
},
},
{
destination: 'variables-large-vw.css',
format: 'css/variables',
filter: 'filter-large-vw',
options: {
selector: `:root`,
outputReferences: true,
},
},
],
};

await sd.cleanAllPlatforms();
await sd.buildAllPlatforms();
};
Expand Down