add new design tokens

This commit is contained in:
madrilene 2024-02-20 08:46:14 +01:00
parent c126a926c6
commit 1fbc1b310b
15 changed files with 93 additions and 35 deletions

View file

@ -0,0 +1,18 @@
{
"title": "Leading",
"description": "Ratio-based leading/line-height values",
"items": [
{
"name": "Flat",
"value": 1
},
{
"name": "Fine",
"value": 1.2
},
{
"name": "Standard",
"value": 1.5
}
]
}

View file

@ -0,0 +1,23 @@
{
"title": "Text Weights",
"description": "Helper classes and custom properties for common font weights",
"meta": {},
"items": [
{
"name": "Regular",
"value": 400
},
{
"name": "Medium",
"value": 500
},
{
"name": "Bold",
"value": 700
},
{
"name": "Extra Bold",
"value": 800
}
]
}

View file

@ -2,5 +2,7 @@
"title": "Viewports", "title": "Viewports",
"description": "The min and maximum viewports used to generate fluid type and space scales.", "description": "The min and maximum viewports used to generate fluid type and space scales.",
"min": 320, "min": 320,
"sm": 640,
"md": 1000,
"max": 1350 "max": 1350
} }

View file

@ -6,7 +6,7 @@
display: inline-block; display: inline-block;
font: inherit; font: inherit;
padding: 0.3rem var(--space-s); padding: 0.3rem var(--space-s);
font-weight: 700; font-weight: var(--font-bold);
text-decoration: none; text-decoration: none;
text-align: center; text-align: center;
} }

View file

@ -39,7 +39,6 @@ pre[class*='language-'] {
word-wrap: normal; word-wrap: normal;
color: var(--color-text-accent); color: var(--color-text-accent);
background: var(--color-bg); background: var(--color-bg);
line-height: 1.5;
border-radius: var(--border-radius); border-radius: var(--border-radius);
hyphens: none; hyphens: none;
} }
@ -165,12 +164,12 @@ pre[class*='language-'] {
.token.id { .token.id {
color: var(--color-code-pink); color: var(--color-code-pink);
font-weight: bold; font-weight: var(--font-bold);
} }
.token.important { .token.important {
color: var(--color-code-pink); color: var(--color-code-pink);
font-weight: bold; font-weight: var(--font-bold);
} }
.token.inserted { .token.inserted {

View file

@ -24,7 +24,7 @@ summary {
gap: 0 1ch; gap: 0 1ch;
cursor: pointer; cursor: pointer;
list-style: none; list-style: none;
font-weight: bold; font-weight: var(--font-bold);
font-size: var(--size-step-1); font-size: var(--size-step-1);
} }
@ -40,7 +40,7 @@ summary::before {
color: var(--color-primary); color: var(--color-primary);
font-family: var(--font-mono); font-family: var(--font-mono);
font-size: var(--size-step-0); font-size: var(--size-step-0);
font-weight: normal; font-weight: var(--font-regular);
line-height: 0.5; line-height: 0.5;
transform: scale(1.4); transform: scale(1.4);
transform-origin: right bottom; transform-origin: right bottom;

View file

@ -8,7 +8,7 @@
} }
.section blockquote { .section blockquote {
font-weight: 700; font-weight: var(--font-bold);
line-height: 1; line-height: 1;
font-size: var(--size-step-4); font-size: var(--size-step-4);
letter-spacing: var(--tracking-s); letter-spacing: var(--tracking-s);

View file

@ -2,7 +2,7 @@
--gutter: var(--space-xs); --gutter: var(--space-xs);
padding: var(--space-s) 0; padding: var(--space-s) 0;
font-size: var(--size-step-0); font-size: var(--size-step-0);
font-weight: bold; font-weight: var(--font-bold);
text-transform: uppercase; text-transform: uppercase;
text-decoration: none; text-decoration: none;
} }

View file

@ -86,7 +86,7 @@
.site-nav-drawer span { .site-nav-drawer span {
font-size: var(--size-step-min-1); font-size: var(--size-step-min-1);
font-weight: bold; font-weight: var(--font-bold);
text-transform: uppercase; text-transform: uppercase;
padding-inline-end: var(--space-2xs); padding-inline-end: var(--space-2xs);
} }

View file

@ -37,7 +37,7 @@ td {
td::before { td::before {
content: attr(data-label); content: attr(data-label);
float: start; float: start;
font-weight: bold; font-weight: var(--font-bold);
} }
td:last-child { td:last-child {
border-block-end: 0; border-block-end: 0;

View file

@ -11,7 +11,7 @@
font-size: var(--size-step-min-2); font-size: var(--size-step-min-2);
text-transform: uppercase; text-transform: uppercase;
padding: 0.1rem 0.625rem; padding: 0.1rem 0.625rem;
font-weight: 700; font-weight: var(--font-bold);
} }
.card .post-tag { .card .post-tag {

View file

@ -8,7 +8,7 @@
border-radius: var(--border-radius); border-radius: var(--border-radius);
font-size: var(--size-step-min-2); font-size: var(--size-step-min-2);
padding: 0.1rem 0.625rem; padding: 0.1rem 0.625rem;
font-weight: 700; font-weight: var(--font-bold);
min-block-size: 1.5em; min-block-size: 1.5em;
text-transform: uppercase; text-transform: uppercase;
} }

View file

@ -5,15 +5,19 @@
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
font-weight: 800; font-weight: 800;
src: local(''), url('/assets/fonts/figtree/figtree-extrabold.woff2') format('woff2'); src:
local(''),
url('/assets/fonts/figtree/figtree-extrabold.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: Figtree; font-family: Figtree;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
font-weight: 600; font-weight: 700;
src: local(''), url('/assets/fonts/figtree/figtree-semibold.woff2') format('woff2'); src:
local(''),
url('/assets/fonts/figtree/figtree-bold.woff2') format('woff2');
} }
@font-face { @font-face {
@ -21,7 +25,9 @@
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
font-weight: 500; font-weight: 500;
src: local(''), url('/assets/fonts/figtree/figtree-medium.woff2') format('woff2'); src:
local(''),
url('/assets/fonts/figtree/figtree-medium.woff2') format('woff2');
} }
@font-face { @font-face {
@ -29,7 +35,8 @@
font-style: italic; font-style: italic;
font-display: swap; font-display: swap;
font-weight: 500; font-weight: 500;
src: local(''), src:
local(''),
url('/assets/fonts/figtree/figtree-mediumitalic.woff2') format('woff2'); url('/assets/fonts/figtree/figtree-mediumitalic.woff2') format('woff2');
} }
} }
@ -38,7 +45,8 @@
@supports (font-variation-settings: normal) { @supports (font-variation-settings: normal) {
@font-face { @font-face {
font-family: 'Figtree'; font-family: 'Figtree';
src: url('/assets/fonts/figtree/figtree-variable[wght].woff2') src:
url('/assets/fonts/figtree/figtree-variable[wght].woff2')
format('woff2 supports variations'), format('woff2 supports variations'),
url('/assets/fonts/figtree/figtree-variable[wght].woff2') format('woff2-variations'); url('/assets/fonts/figtree/figtree-variable[wght].woff2') format('woff2-variations');
font-weight: 300 900; font-weight: 300 900;
@ -48,7 +56,8 @@
@font-face { @font-face {
font-family: 'Figtree'; font-family: 'Figtree';
src: url('/assets/fonts/figtree/figtree-variable-italic[wght].woff2') src:
url('/assets/fonts/figtree/figtree-variable-italic[wght].woff2')
format('woff2 supports variations'), format('woff2 supports variations'),
url('/assets/fonts/figtree/figtree-variable-italic[wght].woff2') url('/assets/fonts/figtree/figtree-variable-italic[wght].woff2')
format('woff2-variations'); format('woff2-variations');
@ -64,7 +73,8 @@
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
font-weight: 700; font-weight: 700;
src: local(''), src:
local(''),
url(/assets/fonts/redhat/red-hat-display-v7-latin-900.woff2) format('woff2'); url(/assets/fonts/redhat/red-hat-display-v7-latin-900.woff2) format('woff2');
} }
@ -73,5 +83,7 @@
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
font-weight: normal; font-weight: normal;
src: local(''), url(/assets/fonts/robotomono/robotomono-regular.woff2) format('woff2'); src:
local(''),
url(/assets/fonts/robotomono/robotomono-regular.woff2) format('woff2');
} }

View file

@ -14,7 +14,7 @@ body {
letter-spacing: var(--tracking); letter-spacing: var(--tracking);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-weight: 500; font-weight: var(--font-medium);
accent-color: var(--color-primary); accent-color: var(--color-primary);
} }
@ -28,7 +28,7 @@ h2,
h3 { h3 {
line-height: 1.2; line-height: 1.2;
letter-spacing: var(--tracking-s); letter-spacing: var(--tracking-s);
font-weight: 700; font-weight: var(--font-bold);
font-family: var(--font-display); font-family: var(--font-display);
} }
@ -74,7 +74,7 @@ svg {
} }
strong { strong {
font-weight: 800; font-weight: var(--font-extra-bold);
} }
hr { hr {

View file

@ -11,12 +11,17 @@ const tokensToTailwind = require('./src/utilities/tokens-to-tailwind.js');
const colorTokens = require('./src/_data/designTokens/colors.json'); const colorTokens = require('./src/_data/designTokens/colors.json');
const fontTokens = require('./src/_data/designTokens/fonts.json'); const fontTokens = require('./src/_data/designTokens/fonts.json');
const spacingTokens = require('./src/_data/designTokens/spacing.json'); const spacingTokens = require('./src/_data/designTokens/spacing.json');
const textSizeTokens = require('./src/_data/designTokens/sizes.json'); const textSizeTokens = require('./src/_data/designTokens/textSizes.json');
const textLeadingTokens = require('./src/_data/designTokens/textLeading.json');
const textWeightTokens = require('./src/_data/designTokens/textWeights.json');
const viewportTokens = require('./src/_data/designTokens/viewports.json');
// Process design tokens // Process design tokens
const colors = tokensToTailwind(colorTokens.items); const colors = tokensToTailwind(colorTokens.items);
const fontFamily = tokensToTailwind(fontTokens.items); const fontFamily = tokensToTailwind(fontTokens.items);
const fontSize = tokensToTailwind(clampGenerator(textSizeTokens.items)); const fontSize = tokensToTailwind(clampGenerator(textSizeTokens.items));
const fontWeight = tokensToTailwind(textWeightTokens.items);
const fontLeading = tokensToTailwind(textLeadingTokens.items);
const spacing = tokensToTailwind(clampGenerator(spacingTokens.items)); const spacing = tokensToTailwind(clampGenerator(spacingTokens.items));
module.exports = { module.exports = {
@ -24,19 +29,16 @@ module.exports = {
presets: [], presets: [],
theme: { theme: {
screens: { screens: {
ltsm: {max: '39em'}, ltsm: {max: `${viewportTokens.sm}px`},
sm: '40em', sm: `${viewportTokens.sm}px`,
md: '63em' md: `${viewportTokens.md}px`
}, },
colors, colors,
spacing, spacing,
fontSize,
fontFamily, fontFamily,
fontWeight: { fontSize,
normal: 500, fontWeight,
semi: 600, fontLeading,
bold: 800
},
backgroundColor: ({theme}) => theme('colors'), backgroundColor: ({theme}) => theme('colors'),
textColor: ({theme}) => theme('colors'), textColor: ({theme}) => theme('colors'),
margin: ({theme}) => ({ margin: ({theme}) => ({
@ -91,7 +93,9 @@ module.exports = {
{key: 'colors', prefix: 'color'}, {key: 'colors', prefix: 'color'},
{key: 'spacing', prefix: 'space'}, {key: 'spacing', prefix: 'space'},
{key: 'fontSize', prefix: 'size'}, {key: 'fontSize', prefix: 'size'},
{key: 'fontFamily', prefix: 'font'} {key: 'fontLeading', prefix: 'leading'},
{key: 'fontFamily', prefix: 'font'},
{key: 'fontWeight', prefix: 'font'}
]; ];
groups.forEach(({key, prefix}) => { groups.forEach(({key, prefix}) => {