Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Commit c78216a

Browse files
committed
Typography: Add heading and code variables
1 parent 5bef808 commit c78216a

File tree

3 files changed

+79
-24
lines changed

3 files changed

+79
-24
lines changed

scss/atoms/typography/_mixins.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/*
22
* ==========================================================================
3-
* Typography functions
3+
* Typography mixins
44
* ==========================================================================
55
*/
6+
@mixin heading($style) {
7+
font-size: em(map-get($style,fontSize));
8+
font-weight: map-get($style,fontWeight);
9+
line-height: 1;
10+
text-transform: map-get($style,capitalization);
11+
}

scss/atoms/typography/_typography.scss

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,27 @@ body {
2121
}
2222

2323
h1 {
24-
font-size: em( 67px ); // 54px works nicely, as well
25-
font-weight: 700;
26-
line-height: 1;
24+
@include heading($h1);
2725
}
2826

2927
h2 {
30-
font-size: em( 36px );
31-
font-weight: 600;
32-
line-height: 1;
28+
@include heading($h2);
3329
}
3430

3531
h3 {
36-
font-size: em( 30px );
37-
font-weight: 600;
38-
line-height: 1;
32+
@include heading($h3);
3933
}
4034

4135
h4 {
42-
font-size: em( 24px );
43-
font-weight: 600;
44-
line-height: 1;
36+
@include heading($h4);
4537
}
4638

4739
h5 {
48-
font-size: em( 20px );
49-
font-weight: 600;
50-
line-height: 1;
40+
@include heading($h5);
5141
}
5242

5343
h6 {
54-
font-size: em( 16px );
55-
font-weight: 600;
56-
line-height: 1;
57-
text-transform: uppercase; // FIXME Is this opinionated?
44+
@include heading($h6);
5845
}
5946

6047
/*
@@ -78,7 +65,7 @@ blockquote {
7865

7966
pre {
8067
padding: 16px 20px;
81-
background: #f7f7f7; // TODO replace with color variable
68+
background: map-get($pre,background);
8269
font: normal 12px/1.4 $monospace;
8370
}
8471

@@ -129,8 +116,8 @@ strong {
129116
}
130117

131118
code {
132-
background: #f2f2f2; // TODO replace with color variable
119+
background: map-get($code,background);
133120
font-size: em( 16px );
134121
padding: em( 4px, 16px ) em( 8px, 16px );
135-
border-radius: 3px; // TODO replace with variable
122+
border-radius: map-get($code,borderRadius);
136123
}

scss/variables/typography.js

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,76 @@ chassis.typography = {
8282
decoration: "none"
8383
}
8484
},
85-
"hr": {
85+
hr: {
8686
name: "HR style",
8787
value: {
8888
color: "#999",
8989
thickness: "1px",
9090
style: "solid"
9191
}
92+
},
93+
code: {
94+
name: "code style",
95+
value: {
96+
background: "#f2f2f2",
97+
borderRadius: "3px"
98+
}
99+
},
100+
pre: {
101+
name: "Pre style",
102+
value: {
103+
background: "#f7f7f7"
104+
}
105+
},
106+
h1: {
107+
name: "H1 Style",
108+
value: {
109+
fontWeight: "700",
110+
fontSize: "67px",
111+
capitalization: "none"
112+
}
113+
},
114+
h2: {
115+
name: "H2 Style",
116+
value: {
117+
fontWeight: "600",
118+
fontSize: "36px",
119+
capitalization: "none"
120+
}
121+
},
122+
h3: {
123+
name: "H3 Style",
124+
value: {
125+
fontWeight: "600",
126+
fontSize: "30px",
127+
capitalization: "none"
128+
}
129+
},
130+
h4: {
131+
name: "H4 Style",
132+
value: {
133+
fontWeight: "600",
134+
fontSize: "24px",
135+
capitalization: "none"
136+
}
137+
},
138+
h5: {
139+
name: "H5 Style",
140+
value: {
141+
fontWeight: "600",
142+
fontSize: "20px",
143+
capitalization: "none"
144+
}
145+
},
146+
h6: {
147+
name: "H6 Style",
148+
value: {
149+
fontWeight: "600",
150+
fontSize: "16px",
151+
capitalization: "uppercase"
152+
}
92153
}
154+
93155
};
94156

95157
return chassis;

0 commit comments

Comments
 (0)