Skip to content

Commit 706643b

Browse files
author
Simon Taggart
authored
feat(tokens): Add box-shadow and line-height tokens (#35)
* feat: add focus box-shadow token * fix(tokens): correct the font size token names in font sizes * feat(tokens): add line-height tokens * fix(tokens): missing digit from SG line-height-70 * feat(theme): add line height tokens to the theme * fix: line-heights and usage of them in the site components
1 parent ec6beef commit 706643b

File tree

13 files changed

+115
-56
lines changed

13 files changed

+115
-56
lines changed

packages/paste-design-tokens/tokens/global/box-shadow.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ global:
33
category: shadow
44
imports:
55
- ../aliases/box-shadow.yml
6+
- ../aliases/offset.yml
67
props:
78
shadow-card:
89
value: "{!shadow-elevation-10}"
910
comment: Shadow for cards.
11+
shadow-focus:
12+
# TODO: need a better solution for this transparent blue
13+
value: "{!offset-0} {!offset-0} {!offset-0} {!offset-20}px rgba(0,117,195,0.5)"
14+
comment: Shadow for focus ring on interactive elements

packages/paste-design-tokens/tokens/global/font-size.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ imports:
66
props:
77
font-size-10:
88
value: "{!font-size-10}"
9-
comment: "Constant typography token for font size 0"
9+
comment: "Constant typography token for font size 10"
1010
font-size-20:
1111
value: "{!font-size-20}"
12-
comment: "Constant typography token for font size 1"
12+
comment: "Constant typography token for font size 20"
1313
font-size-30:
1414
value: "{!font-size-30}"
15-
comment: "Constant typography token for font size 2"
15+
comment: "Constant typography token for font size 30"
1616
font-size-40:
1717
value: "{!font-size-40}"
18-
comment: "Constant typography token for font size 3"
18+
comment: "Constant typography token for font size 40"
1919
font-size-50:
2020
value: "{!font-size-50}"
21-
comment: "Constant typography token for font size 4"
21+
comment: "Constant typography token for font size 50"
2222
font-size-60:
2323
value: "{!font-size-60}"
24-
comment: "Constant typography token for font size 5"
24+
comment: "Constant typography token for font size 60"
2525
font-size-70:
2626
value: "{!font-size-70}"
27-
comment: "Constant typography token for font size 6"
27+
comment: "Constant typography token for font size 70"
2828
font-size-80:
2929
value: "{!font-size-80}"
30-
comment: "Constant typography token for font size 7"
30+
comment: "Constant typography token for font size 80"
3131
font-size-90:
3232
value: "{!font-size-90}"
33-
comment: "Constant typography token for font size 8"
33+
comment: "Constant typography token for font size 90"
3434
font-size-100:
3535
value: "{!font-size-100}"
36-
comment: "Constant typography token for font size 9"
36+
comment: "Constant typography token for font size 100"

packages/paste-design-tokens/tokens/global/index.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ imports:
77
- ./font-family.yml
88
- ./font-size.yml
99
- ./font-weight.yml
10+
- ./line-height.yml
1011
- ./palette-color.yml
1112
- ./sizing.yml
1213
- ./spacing.yml
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
global:
2+
category: line-height
3+
type: number
4+
props:
5+
line-height-10:
6+
value: "1.666666667" ##12px * 1.666666667 = 20px
7+
comment: "Constant line-height token for font size 10"
8+
line-height-20:
9+
value: "1.714285714" ##14px * 1.714285714 = 24px
10+
comment: "Constant line-height token for font size 20"
11+
line-height-30:
12+
value: "1.5" ##16px * 1.5 = 24px
13+
comment: "Constant line-height token for font size 30"
14+
line-height-40:
15+
value: "1.555555556" ##18px * 1.555555556 = 28px
16+
comment: "Constant line-height token for font size 40"
17+
line-height-50:
18+
value: "1.6" ##20px * 1.6 = 32px
19+
comment: "Constant line-height token for font size 50"
20+
line-height-60:
21+
value: "1.5" ##24px * 1.5 = 36px
22+
comment: "Constant line-height token for font size 60"
23+
line-height-70:
24+
value: "1.5" ##24px * 1.5 = 36px
25+
comment: "Constant line-height token for font size 70"
26+
line-height-80:
27+
value: "1.5" ##24px * 1.5 = 36px
28+
comment: "Constant line-height token for font size 80"
29+
line-height-90:
30+
value: "1.5" ##24px * 1.5 = 36px
31+
comment: "Constant line-height token for font size 90"
32+
line-height-100:
33+
value: "1.5" ##24px * 1.5 = 36px
34+
comment: "Constant line-height token for font size 100"

packages/paste-design-tokens/tokens/themes/sendgrid/global/font-size.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ imports:
77
props:
88
font-size-10:
99
value: "{!font-size-10}"
10-
comment: "Constant typography token for font size 0"
10+
comment: "Constant typography token for font size 10"
1111
font-size-20:
1212
value: "{!font-size-20}"
13-
comment: "Constant typography token for font size 1"
13+
comment: "Constant typography token for font size 20"
1414
font-size-30:
1515
value: "{!font-size-30}"
16-
comment: "Constant typography token for font size 2"
16+
comment: "Constant typography token for font size 30"
1717
font-size-40:
1818
value: "{!font-size-40}"
19-
comment: "Constant typography token for font size 3"
19+
comment: "Constant typography token for font size 40"
2020
font-size-50:
2121
value: "{!font-size-50}"
22-
comment: "Constant typography token for font size 4"
22+
comment: "Constant typography token for font size 50"
2323
font-size-60:
2424
value: "{!font-size-60}"
25-
comment: "Constant typography token for font size 5"
25+
comment: "Constant typography token for font size 60"
2626
font-size-70:
2727
value: "{!font-size-70}"
28-
comment: "Constant typography token for font size 6"
28+
comment: "Constant typography token for font size 70"
2929
font-size-80:
3030
value: "{!font-size-80}"
31-
comment: "Constant typography token for font size 7"
31+
comment: "Constant typography token for font size 80"
3232
font-size-90:
3333
value: "{!font-size-90}"
34-
comment: "Constant typography token for font size 8"
34+
comment: "Constant typography token for font size 90"
3535
font-size-100:
3636
value: "{!font-size-100}"
37-
comment: "Constant typography token for font size 9"
37+
comment: "Constant typography token for font size 100"

packages/paste-design-tokens/tokens/themes/sendgrid/global/index.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ imports:
77
- ./font-family.yml
88
- ./font-size.yml
99
- ./font-weight.yml
10+
- ./line-height.yml
1011
- ./palette-color.yml
1112
- ./sizing.yml
1213
- ./spacing.yml
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
global:
2+
category: line-height
3+
type: number
4+
imports:
5+
- ../../../global/line-height.yml
6+
props:
7+
line-height-10:
8+
value: "1.666666667" #12px * 1.666666667 = 20px
9+
comment: "Constant line-height token for font size 10"
10+
line-height-20:
11+
value: "1.714285714" #14px * 1.714285714 = 24px
12+
comment: "Constant line-height token for font size 20"
13+
line-height-30:
14+
value: "1.5" #16px * 1.5 = 24px
15+
comment: "Constant line-height token for font size 30"
16+
line-height-40:
17+
value: "1.555555556" #18px * 1.555555556 = 28px
18+
comment: "Constant line-height token for font size 40"
19+
line-height-50:
20+
value: "1.6" #20px * 1.6 = 32px
21+
comment: "Constant line-height token for font size 50"
22+
line-height-60:
23+
value: "1.5" #24px * 1.5 = 36px
24+
comment: "Constant line-height token for font size 60"
25+
line-height-70:
26+
value: "1.571428571" #28px * 1.57 = 44px
27+
comment: "Constant line-height token for font size 70"
28+
line-height-80:
29+
value: "1.5" #32px * 1.5 = 48px
30+
comment: "Constant line-height token for font size 80"
31+
line-height-90:
32+
value: "1.5" #32px * 1.5 = 48px
33+
comment: "Constant line-height token for font size 90"
34+
line-height-100:
35+
value: "1.5" #32px * 1.5 = 48px
36+
comment: "Constant line-height token for font size 100"

packages/paste-theme-tokens/src/default/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
fonts,
88
fontSizes,
99
fontWeights,
10+
lineHeights,
1011
shadows,
1112
sizings,
1213
spacings,
@@ -16,16 +17,6 @@ import {
1617

1718
const breakpoints = [sizings.size40, sizings.size100, sizings.size120];
1819
const space = {...spacings};
19-
const lineHeights = {
20-
lineHeight10: '0.75rem', // #12px
21-
lineHeight20: '1rem', // #16px
22-
lineHeight30: '1.25rem', // #20px
23-
lineHeight40: '1.5rem', // #24px
24-
lineHeight50: '1.75rem', // #28px
25-
lineHeight60: '2rem', // #32px
26-
lineHeight70: '2.25rem', // #36px
27-
lineHeight80: '2.5rem', // #40px
28-
};
2920
const maxWidths = {
3021
...sizings,
3122
};

packages/paste-theme-tokens/src/sendgrid/index.ts

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
fonts,
88
fontSizes,
99
fontWeights,
10+
lineHeights,
1011
shadows,
1112
sizings,
1213
spacings,
@@ -16,16 +17,6 @@ import {
1617

1718
const breakpoints = [sizings.size40, sizings.size100, sizings.size120];
1819
const space = {...spacings};
19-
const lineHeights = {
20-
lineHeight10: '0.75rem', // #12px
21-
lineHeight20: '1rem', // #16px
22-
lineHeight30: '1.25rem', // #20px
23-
lineHeight40: '1.5rem', // #24px
24-
lineHeight50: '1.75rem', // #28px
25-
lineHeight60: '2rem', // #32px
26-
lineHeight70: '2.25rem', // #36px
27-
lineHeight80: '2.5rem', // #40px
28-
};
2920
const maxWidths = {
3021
...sizings,
3122
};
@@ -39,22 +30,22 @@ const heights = {
3930
...sizings,
4031
};
4132
export const SendGridTheme = {
42-
colors,
43-
shadows,
44-
space,
33+
backgroundColors,
34+
borderColors,
35+
borderWidths,
4536
breakpoints,
46-
fontSizes,
37+
colors,
4738
fonts,
39+
fontSizes,
4840
fontWeights,
41+
heights,
4942
lineHeights,
50-
textColors,
51-
backgroundColors,
52-
borderColors,
5343
maxWidths,
5444
minWidths,
55-
widths,
56-
heights,
5745
radii,
58-
borderWidths,
46+
shadows,
47+
space,
48+
textColors,
49+
widths,
5950
zIndices,
6051
};

packages/paste-website/src/components/breadcrumb/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Breadcrumb: React.FC<{}> = ({children}) => {
2727
// TODO use correct tokens for lineHeight after fix
2828
const BreadcrumbItem = styled(Link)`
2929
font-size: ${themeGet('fontSizes.fontSize20')};
30-
line-height: ${themeGet('lineHeights.lineHeight50')};
30+
line-height: ${themeGet('lineHeights.lineHeight20')};
3131
letter-spacing: normal;
3232
color: ${themeGet('textColors.colorTextLink')};
3333
`;

0 commit comments

Comments
 (0)