This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
_typography.scss
255 lines (216 loc) · 4.98 KB
/
_typography.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
@use '../settings/variables' as v;
@use '@justeat/pie-design-tokens/dist/jet' as dt;
@use '../tools/mixins/type';
@use '../tools/functions/index' as functions;
@use '../settings/include-media' as *;
@mixin typography() {
/**
* Typography
* =================================
* - Base
* - Paragraphs
* - Headings
* - Type sizes
* - Misc
* - Utilities
*
* Body font size, leadings etc have been set in _variables.scss
*
* This is an optional component within Fozzie.
* If you'd like to use it in your project you can include it by adding `@include typography();` into your SCSS dependencies file.
*
* Documentation:
* TBC
*/
/**
* Typography preloading styles
*/
html {
font-size: v.$font-size-base-px; //default font size in px (16px)
text-size-adjust: 100%;
}
body {
font-family: v.$font-family-base;
@include type.font-size(body-l); // default body font size == 1rem/16px
color: dt.$color-content-default;
font-weight: dt.$font-weight-regular;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
}
/**
* Paragraphs
*/
p {
@include type.font-size(body-l);
margin-top: functions.spacing(d);
margin-bottom: 0;
}
/**
* Headings
*/
h1,
h2,
h3,
h4,
h5,
h6,
.alpha,
.beta,
.gamma,
.delta,
.epsilon {
color: dt.$color-content-default;
margin: 0;
margin-bottom: 0;
font-family: v.$font-family-base;
font-weight: v.$font-weight-headings;
small {
font-weight: normal;
}
}
// Use the helper classes to emulate styles for another element
// For example: h3.h1 or h3.alpha
h1,
.alpha {
@include type.font-size(heading-xl, true, narrow);
margin-top: functions.spacing(f);
margin-bottom: functions.spacing(d);
@include media('>mid') {
@include type.font-size(heading-xl);
}
&:first-child {
margin-top: 0;
}
}
h2,
.beta {
@include type.font-size(heading-m, true, narrow);
@include media('>mid') {
@include type.font-size(heading-m);
}
}
h3,
.gamma,
h4,
.delta,
h5,
.epsilon {
@include type.font-size(heading-s, true, narrow);
@include media('>mid') {
@include type.font-size(heading-s);
}
}
h6,
.zeta {
@include type.font-size(caption);
}
// Only give these headings a margin-top if they are after other elements
* + h2,
* + .beta {
margin-top: functions.spacing(f);
}
* + h3,
* + .gamma,
* + h4,
* + .delta {
margin-top: functions.spacing(d);
}
small {
font-size: 80%;
}
/**
* Miscellaneous
*/
// Emphasis
strong,
b {
font-weight: dt.$font-weight-bold;
}
em,
i {
font-style: italic;
}
// Abbreviations and acronyms
abbr[title] {
border-bottom: 1px dotted #ddd;
cursor: help;
}
/**
* Blockquotes
*/
blockquote {
padding-left: 10px;
margin: functions.spacing(d);
border-left: 4px solid lighten(#000, 80%);
p {
margin-bottom: 0;
@include type.font-size(body-s);
font-weight: 300;
}
small {
display: block;
color: lighten(#000, 70%);
&:before {
content: '\2014 \00A0';
}
}
}
/**
* Buttons
*/
button {
font-family: v.$font-family-base;
}
// Quotes
q,
blockquote {
&:before,
&:after {
content: '';
}
}
cite {
font-style: normal;
}
// Addresses styling not present in S5, Chrome
dfn {
font-style: italic;
}
mark {
background: dt.$color-yellow-10;
padding: 2px 4px;
border-radius: dt.$radius-rounded-a;
}
address {
font-style: normal;
margin-top: functions.spacing(d);
margin-bottom: 0;
}
// Prevents sub and sup affecting line-height in all browsers
// gist.github.com/413930
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup { top: -0.5em; }
sub { bottom: -0.25em; }
samp { font-family: v.$font-family-mono; }
//
// @include ko-text-selection($color-selection, $color-selection-bg);
// Horizontal rules
hr {
margin: functions.spacing(d) 0;
border: 0;
border-top: 1px solid dt.$color-divider-default;
}
// https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/
.hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}
}