Skip to content

Commit bcf5f46

Browse files
andreamanganolmammino
authored andcommitted
Feature/new typo system (#2)
* Fix linter * Adds function to create the basic style for typography * Includes font from googlefonts * Changes font family * Creates typography using mixin * Unused * Fix lint * Fix lint * Removes unused sass placeholders to generate the typography * Adds node-sass-utils as dependency * Adds functions for getting the typography settings from the sass environment at compile time. * Adds typography data to pug locals to render the specifications on the docs. * Adds external settings file for typography * Improves function to generate typography * Updates style in typography block * Updates docs templates and mixins
1 parent fdcbe65 commit bcf5f46

File tree

17 files changed

+176
-166
lines changed

17 files changed

+176
-166
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
$palette-primary: get-palette('primary');
22
$palette-neutral: get-palette('neutral');
33

4-
@function primaryColor($color) {
4+
@function primary-color($color) {
55
@return map-get($palette-primary, $color);
66
}
77

8-
@function neutralColor($color) {
8+
@function neutral-color($color) {
99
@return map-get($palette-neutral, $color);
1010
}
11-

assets/scss/2-tools/mixins/_typography.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,26 @@
55
}
66
}
77
}
8+
9+
@mixin get-typo($tag, $data: null) {
10+
@if ($data == null) {
11+
$data: get-typo($tag);
12+
}
13+
@each $key, $value in $data {
14+
@if ($key == sizes) {
15+
@include responsive-typo($value);
16+
} @elseif ($key == 'font-size') {
17+
#{$key}: rem-calc($value);
18+
} @else {
19+
#{$key}: $value;
20+
}
21+
}
22+
}
23+
24+
@mixin print-typography() {
25+
@each $key, $value in get-typography() {
26+
#{$key} {
27+
@include get-typo($key, $value);
28+
}
29+
}
30+
}

assets/scss/3-generic/_layout-settings.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ $v-unit: rem-calc(16);
2020
$h-unit: rem-calc(16);
2121

2222
// Fonts
23-
// $base-font-family: 'gotham', sans-serif;
24-
$base-font-family: 'okomito', sans-serif;
23+
$base-font-family: 'Roboto', sans-serif;
2524
$layout-wrapper-sizes: ('medium': 960, 'large': 1050, 'huge': 1200);
2625

2726
$layout-slide-wrapper: rem-calc(900);
Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1 @@
1-
h1 {
2-
@extend %h1;
3-
margin: $v-unit * 1.5 0;
4-
}
5-
6-
h2 {
7-
@extend %h2;
8-
margin: $v-unit * 1.5 0;
9-
}
10-
11-
h3 {
12-
@extend %h3;
13-
margin: $v-unit 0 ($v-unit / 2);
14-
}
15-
16-
h4 {
17-
@extend %h4;
18-
margin: $v-unit / 2 0;
19-
}
20-
21-
h5 {
22-
@extend %h5;
23-
margin: $v-unit / 2 0;
24-
}
25-
26-
h6 {
27-
@extend %h6;
28-
margin: $v-unit / 2 0;
29-
}
30-
31-
p {
32-
@extend %p;
33-
margin: $v-unit / 2 0;
34-
35-
&:first-child {
36-
margin-top: 0;
37-
}
38-
39-
&:last-child {
40-
margin-bottom: 0;
41-
}
42-
}
43-
44-
small {
45-
// @include moderato;
46-
}
47-
48-
strong {
49-
font-weight: 700;
50-
}
51-
52-
a {
53-
color: currentColor;
54-
text-decoration: none;
55-
}
1+
@include print-typography();

assets/scss/4-base/placeholders/_typography.scss

Lines changed: 0 additions & 63 deletions
This file was deleted.

assets/scss/7-pages/_layout.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
.layout {
2-
color: neutralColor('neutral-highest');
2+
color: neutral-color('neutral-highest');
33
font-family: $base-font-family;
44
font-size: 16px;
5-
text-rendering: optimizeLegibility;
65
padding: rem-calc(10);
6+
text-rendering: optimizeLegibility;
77

8-
&__page {
9-
}
10-
}
8+
// &__page {}
9+
}

assets/scss/docs.scss

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
padding-bottom: $v-unit * 4;
1414

1515
&__title {
16-
border-bottom: 1px solid neutralColor('low');
16+
border-bottom: 1px solid neutral-color('low');
1717
padding-bottom: $v-unit * 2;
1818
text-transform: capitalize;
1919
}
@@ -28,29 +28,58 @@
2828
}
2929

3030
&__preview {
31-
background-color: neutralColor('low');
32-
border: 1px solid neutralColor('low');
31+
background-color: neutral-color('low');
32+
border: 1px solid neutral-color('low');
3333
padding: ($v-unit * 2) ($h-unit * 2);
3434
}
3535
}
3636

3737
.headings-grid {
3838

39-
&__list {}
39+
// &__list {}
4040

4141
&__item {
42-
border-bottom: 1px solid neutralColor('low');
43-
padding: $v-unit 0;
42+
border-bottom: 1px dotted neutral-color('low');
43+
padding: $v-unit * 1.5 0;
4444

4545
&:last-child {
4646
border-bottom: 0;
4747
}
4848

4949
* {
50-
line-height: 1;
5150
margin: 0;
5251
}
5352
}
53+
54+
&__type {
55+
&::before {
56+
content: '<';
57+
}
58+
59+
&::after {
60+
content: '/>';
61+
}
62+
}
63+
64+
&__family {
65+
margin-top: $v-unit / 2;
66+
}
67+
68+
&__sizes {
69+
background-color: neutral-color('lower');
70+
display: inline-flex;
71+
margin-top: $v-unit;
72+
padding: rem-calc(2 4);
73+
}
74+
75+
&__size {
76+
margin-right: $h-unit / 2;
77+
text-transform: capitalize;
78+
79+
&:last-child {
80+
margin-right: 0;
81+
}
82+
}
5483
}
5584

5685
.palette-grid {
@@ -69,8 +98,8 @@
6998
}
7099

71100
.color-box {
72-
background-color: neutralColor('lowest');
73-
box-shadow: 0 2px 4px rgba(neutralColor('highest'), .2);
101+
background-color: neutral-color('lowest');
102+
box-shadow: 0 2px 4px rgba(neutral-color('highest'), .2);
74103

75104
&__swatch {
76105
display: block;
@@ -87,6 +116,6 @@
87116
}
88117

89118
&__hex {
90-
color: neutralColor('medium');
119+
color: neutral-color('medium');
91120
}
92121
}

assets/scss/main.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
@import './3-generic/layout-settings';
99

1010
@import './4-base/fonts/primary';
11-
@import './4-base/placeholders/typography';
1211
@import './4-base/typography';
1312

1413
@import './7-pages/layout';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"cpx": "^1.5.0",
6464
"imagemin-cli": "^3.0.0",
6565
"node-sass": "^4.3.0",
66+
"node-sass-utils": "^1.1.2",
6667
"npm-run-all": "^4.0.1",
6768
"onchange": "^3.2.1",
6869
"postcss-cli": "^2.6.0",

settings/pug.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var palettes = require('./palette');
21
var data = require('./../dist/data.json');
3-
data.palettes = palettes;
4-
module.exports = data;
2+
data.palettes = require('./palette');
3+
data.typography = require('./typography');
4+
module.exports = data;

0 commit comments

Comments
 (0)