Skip to content

Commit f93f433

Browse files
committed
Relatieve lettergrootte i.v.m. toegankelijkheid
1 parent 39f60e7 commit f93f433

3 files changed

Lines changed: 52 additions & 16 deletions

File tree

plugins/gh-datainmap/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- Lettergrootte in standaard stylesheet aangepast van absolute lengte-eenheid naar relatieve lengte-eenheid i.v.m. toegankelijkheid.
2+
13
**1.10.3 (2021-12-14)**
24

35
- Fix voor kaartweergave in de backend bij beheren locatie. Deze weas door een verouderde URL niet zichtbaar.

src/scss/mixins/_mixins.scss

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,43 @@ border-radius: $radius;
2323
box-shadow: $shadow;
2424
}
2525

26+
// Bron: https://css-tricks.com/snippets/sass/strip-unit-function/
27+
/// Remove the unit of a length
28+
/// @param {Number} $number - Number to remove unit from
29+
/// @return {Number} - Unitless number
30+
@function strip-unit($number) {
31+
@if type-of($number) == 'number' and not unitless($number) {
32+
@return $number / ($number * 0 + 1);
33+
}
34+
@return $number;
35+
}
36+
2637
// Rem output with px fallback
27-
@mixin font-size($sizeValue: 1) {
28-
font-size: ($sizeValue * 16) * 1px;
29-
font-size: $sizeValue * 1rem;
38+
@mixin font-size($sizeValue: 1, $important: null) {
39+
@if type-of($important) == 'bool' {
40+
@if $important == true {
41+
$important: !important;
42+
}
43+
@else {
44+
$important: null;
45+
}
46+
}
47+
// px input
48+
@if unit($sizeValue) == 'px' {
49+
font-size: $sizeValue $important;
50+
font-size: strip-unit(percentage($sizeValue / $font-size-base) / 100) * 1rem $important;
51+
}
52+
// rem input
53+
@else if unitless($sizeValue) {
54+
font-size: ceil($sizeValue * strip-unit($font-size-base)) * 1px $important;
55+
font-size: $sizeValue * 1rem $important;
56+
}
57+
// Fallthrough
58+
@else {
59+
$unit: unit($sizeValue);
60+
@warn 'Mixin font-size() ondersteund geen `#{$unit}`, opgegeven unit: #{$sizeValue}';
61+
font-size: $sizeValue $important;
62+
}
3063
}
3164

3265
// Center block

src/scss/style.scss

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$font-size-base: 14px;
12
@import './mixins/mixins';
23
@import './modules/modules';
34
@import './transitions';
@@ -19,7 +20,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
1920
bottom:.5em;
2021
}
2122
.ol-control button {
22-
font-size:20px;
23+
@include font-size(20px);
2324
background-color:$bgcolor-button-neutral;
2425
color:$textcolor-button-neutral;
2526

@@ -94,7 +95,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
9495
margin:0 -20px;
9596
background-color:$bgcolor-button-neutral;
9697
h1 {
97-
font-size:14px;
98+
@include font-size(14px);
9899
margin:0;
99100
padding:10px;
100101
font-weight:bold;
@@ -113,20 +114,20 @@ $shadow-color: rgba(0, 0, 0, 0.5);
113114
margin:10px 0;
114115
button {
115116
@extend .btn !optional;
116-
font-size:12px;
117+
@include font-size(12px);
117118
}
118119
}
119120
.#{$descriptionClass} {
120121
margin:10px 0;
121-
font-size:12px;
122+
@include font-size(12px);
122123
font-style:italic;
123124
}
124125
.#{checkboxClass} {
125126
&:first-child {
126127
margin-top:10px;
127128
}
128129
label {
129-
font-size: 12px;
130+
@include font-size(12px);
130131
font-weight:normal;
131132
}
132133
}
@@ -179,7 +180,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
179180
line-height:1.5;
180181
border:1px solid #ccc;
181182
padding:5px 10px;
182-
font-size:12px;
183+
@include font-size(12px);
183184
border-top-left-radius:3px;
184185
border-top-right-radius:3px;
185186
}
@@ -199,7 +200,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
199200
@media all and (min-width: $screen-md) {
200201
min-width:300px;
201202
}
202-
font-size:12px;
203+
@include font-size(12px);
203204

204205
&:last-child {
205206
border-bottom-style: none;
@@ -287,7 +288,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
287288
max-width:320px;
288289
span {
289290
font-weight: bold;
290-
font-size:12px;
291+
@include font-size(12px);
291292
}
292293
}
293294
.gh-dim-features-listbox {
@@ -364,7 +365,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
364365
margin:0 -20px;
365366
background-color:$bgcolor-button-neutral;
366367
h1 {
367-
font-size:14px;
368+
@include font-size(14px);
368369
margin:0;
369370
padding:10px;
370371
font-weight:bold;
@@ -387,7 +388,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
387388
padding-right:20px;
388389
.gh-dim-features-listbox-description {
389390
margin:10px;
390-
font-size:12px;
391+
@include font-size(12px);
391392
font-style:italic;
392393
}
393394

@@ -405,7 +406,7 @@ $shadow-color: rgba(0, 0, 0, 0.5);
405406
@media all and (min-width: $screen-md) {
406407
min-width:300px;
407408
}
408-
font-size:12px;
409+
@include font-size(12px);
409410

410411
&:hover {
411412
background-color:#EBEBEB;
@@ -464,7 +465,7 @@ body.gh-dim-modal-open {
464465
background-color:$bgcolor-feature-header;
465466
border-radius:6px 6px 0 0;
466467
h1 {
467-
font-size:24px;
468+
@include font-size(24px);
468469
margin:0;
469470
color:#FFF;
470471
overflow:hidden;
@@ -479,7 +480,7 @@ body.gh-dim-modal-open {
479480
right:24px;
480481
.gh-dim-modal-close-marker {
481482
display:inline-block;
482-
font-size:48px;
483+
@include font-size(48px);
483484
font-weight:normal;
484485
color:$textcolor-button-hover;
485486
margin-top:12px;

0 commit comments

Comments
 (0)