check for valid font-weights in typography mixins

This commit is contained in:
Ray Elliott 2020-04-22 19:08:58 +00:00
parent 27a87af44f
commit a52470e8b8
3 changed files with 18 additions and 10 deletions

View File

@ -11,7 +11,7 @@
{{ with $stylesheet.css }} {{ with $stylesheet.css }}
<link href="{{ relURL . }}" rel="stylesheet"> <link href="{{ relURL . }}" rel="stylesheet">
{{ end }} {{ end }}
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap" rel="stylesheet">
</head> </head>
<body> <body>

View File

@ -1,14 +1,22 @@
@mixin font-body($weight: normal) { @mixin font-1($weight) {
font-family: "Montserrat", sans-serif; font-family: "Montserrat", sans-serif;
font-weight: $weight; @if $weight == regular {
font-weight: 400;
} @else if $weight == bold {
font-weight: 600;
} @else {
@error "font-weight #{$weight} not in valid font-weights for font-1: 'Montserrat'.";
}
} }
@mixin font-title($weight: normal) { @mixin font-body($weight: regular) {
font-family: "Montserrat", sans-serif; @include font-1($weight);
font-weight: $weight;
} }
@mixin font-link($weight: normal) { @mixin font-title($weight: regular) {
font-family: "Montserrat", sans-serif; @include font-1($weight);
font-weight: $weight; }
@mixin font-link($weight: regular) {
@include font-1($weight);
} }

View File

@ -6,9 +6,9 @@
@import "imports/mixins.scss"; @import "imports/mixins.scss";
@import "imports/typography.scss";
@import "imports/base.scss"; @import "imports/base.scss";
@import "imports/layout.scss"; @import "imports/layout.scss";
@import "imports/typography.scss";
@import "imports/utility.scss"; @import "imports/utility.scss";