Skip to content

Commit 00458bc

Browse files
authored
refactor: typography token (#978)
* refactor: typography token * fix: typography token * chore
1 parent 4eafb09 commit 00458bc

File tree

1 file changed

+64
-76
lines changed

1 file changed

+64
-76
lines changed

app/assets/styles/main.css

Lines changed: 64 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import "./custom-media-query.css";
33
@import "./reset.css";
44

5-
/**
5+
/**
66
* Colors
77
------------------------------------------ */
88

@@ -41,26 +41,26 @@
4141
--color-alert: #db0000;
4242
}
4343

44-
/**
44+
/**
4545
* Z-index layers
4646
------------------------------------------ */
4747

4848
:root {
4949
/* Background layers */
5050
--z-index-background: -1;
51-
51+
5252
/* Base content layers */
5353
--z-index-base: 1;
5454
--z-name-badge-highlight: 2;
55-
55+
5656
/* UI layers */
5757
--z-index-header: 100;
5858
--z-index-navigation: 200;
59-
59+
6060
/* Overlay layers */
6161
--z-index-overlay: 300;
6262
--z-index-modal: 400;
63-
63+
6464
/* Special layers */
6565
--z-index-focused-name-badge: 9999;
6666
}
@@ -82,7 +82,8 @@ body {
8282
color: var(--color-base);
8383
}
8484

85-
h2, h3 {
85+
h2,
86+
h3 {
8687
color: var(--color-text-default);
8788
margin-bottom: 0.5rem;
8889
}
@@ -135,103 +136,91 @@ body {
135136
}
136137
}
137138

138-
/**
139+
/**
140+
* Typography (token)
141+
------------------------------------------ */
142+
:root {
143+
--typography-h1-size: 20px;
144+
--typography-h1-line-height: 30px;
145+
--typography-h2-size: 18px;
146+
--typography-h2-line-height: 27px;
147+
--typography-h3-size: 16px;
148+
--typography-h3-line-height: 24px;
149+
--typography-body1-size: 16px;
150+
--typography-body1-line-height: 24px;
151+
--typography-body2-size: 14px;
152+
--typography-body2-line-height: 21px;
153+
--typography-body3-size: 13px;
154+
--typography-body3-line-height: 19.5px;
155+
--typography-caption-size: 11px;
156+
--typography-caption-line-height: 16.5px;
157+
158+
@media (--mobile) {
159+
--typography-h1-size: 18px;
160+
--typography-h1-line-height: 27px;
161+
--typography-h2-size: 16px;
162+
--typography-h2-line-height: 24px;
163+
--typography-h3-size: 14px;
164+
--typography-h3-line-height: 21px;
165+
--typography-body1-size: 14px;
166+
--typography-body1-line-height: 21px;
167+
--typography-body2-size: 12px;
168+
--typography-body2-line-height: 18px;
169+
--typography-body3-size: 11px;
170+
--typography-body3-line-height: 15px;
171+
--typography-caption-size: 10px;
172+
--typography-caption-line-height: 15px;
173+
}
174+
}
175+
176+
/**
139177
* Typography
140178
------------------------------------------ */
141179

142180
:root {
143181
/* align to BODY1 */
144182
* {
145-
font-size: 16px;
146-
line-height: 24px;
183+
font-size: var(--typography-body1-size);
184+
line-height: var(--typography-body1-line-height);
147185
}
148186

149187
h1 {
150-
font-size: 20px;
151-
line-height: 30px;
188+
font-size: var(--typography-h1-size);
189+
line-height: var(--typography-h1-line-height);
152190
}
153191

154192
h2 {
155-
font-size: 18px;
156-
line-height: 27px;
193+
font-size: var(--typography-h2-size);
194+
line-height: var(--typography-h2-line-height);
157195
}
158196

159197
h3 {
160-
font-size: 16px;
161-
line-height: 24px;
198+
font-size: var(--typography-h3-size);
199+
line-height: var(--typography-h3-line-height);
162200
}
163201

164202
/**
165-
* utilities
203+
* utilities
166204
------------------------------------------ */
167205

168206
.text-body-1 {
169-
font-size: 16px;
170-
line-height: 24px;
207+
font-size: var(--typography-body1-size);
208+
line-height: var(--typography-body1-line-height);
171209
}
172210

173211
.text-body-2 {
174-
font-size: 14px;
175-
line-height: 21px;
212+
font-size: var(--typography-body2-size);
213+
line-height: var(--typography-body2-line-height);
176214
}
177215

178216
.text-body-3 {
179-
font-size: 13px;
180-
line-height: 19.5px;
217+
font-size: var(--typography-body3-size);
218+
line-height: var(--typography-body3-line-height);
181219
}
182220

183221
.text-caption {
184-
font-size: 11px;
185-
line-height: 16.5px;
186-
}
187-
}
188-
189-
@media (--mobile) {
190-
:root {
191-
/* align to BODY1 */
192-
* {
193-
font-size: 14px;
194-
line-height: 21px;
195-
}
196-
197-
h1 {
198-
font-size: 18px;
199-
line-height: 27px;
200-
}
201-
202-
h2 {
203-
font-size: 16px;
204-
line-height: 24px;
205-
}
206-
207-
h3 {
208-
font-size: 14px;
209-
line-height: 21px;
210-
}
211-
212-
/**
213-
* utilities
214-
------------------------------------------ */
215-
216-
.text-body-1 {
217-
font-size: 14px;
218-
line-height: 21px;
219-
}
220-
221-
.text-body-2 {
222-
font-size: 12px;
223-
line-height: 18px;
224-
}
225-
226-
.text-body-3 {
227-
font-size: 11px;
228-
line-height: 15px;
229-
}
230-
231-
.text-caption {
232-
font-size: 10px;
233-
line-height: 15px;
234-
}
222+
font-size: var(--typography-caption-size);
223+
line-height: var(--typography-caption-line-height);
235224
}
236225
}
237226

@@ -262,7 +251,7 @@ body {
262251
}
263252
}
264253

265-
/**
254+
/**
266255
* Radius
267256
------------------------------------------ */
268257

@@ -283,7 +272,6 @@ p {
283272
}
284273
}
285274

286-
287275
/**
288276
* Smooth Scroll
289277
------------------------------------------ */

0 commit comments

Comments
 (0)