@internetstiftelsen/styleguide 4.1.13 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/js/iconToggle.js +1 -2
- package/dist/assets/js/parallax.js +0 -2
- package/dist/assets/js/textToggle.js +0 -1
- package/dist/assets/js/track.js +2 -2
- package/dist/assets/js/youtube.js +2 -1
- package/dist/components.js +0 -4
- package/dist/molecules/glider/glider-hero.js +1 -2
- package/dist/molecules/modal/modal.js +2 -2
- package/dist/molecules/overview-navigation/overview-navigation.js +1 -2
- package/dist/organisms/mailchimp/mailchimp.js +2 -1
- package/dist/organisms/tabs/tabs.js +3 -2
- package/dist/organisms/timeline/timeline.js +2 -4
- package/package.json +23 -18
- package/src/app.js +1 -15
- package/src/app.scss +85 -88
- package/src/assets/js/iconToggle.js +2 -2
- package/src/assets/js/parallax.js +0 -2
- package/src/assets/js/textToggle.js +1 -1
- package/src/assets/js/track.js +2 -2
- package/src/assets/js/youtube.js +2 -1
- package/src/atoms/archive-link/archive-link.config.js +1 -1
- package/src/atoms/archive-link/archive-link.scss +24 -17
- package/src/atoms/button/_button.scss +216 -210
- package/src/atoms/checkbox/_checkbox.scss +33 -26
- package/src/atoms/checkbox/checkbox.config.js +1 -1
- package/src/atoms/file/_file.scss +23 -13
- package/src/atoms/file/file.config.js +1 -1
- package/src/atoms/grid-toggle/_grid-toggle.scss +11 -6
- package/src/atoms/grid-toggle/grid-toggle.config.js +1 -1
- package/src/atoms/height-limiter/_height-limiter.scss +21 -14
- package/src/atoms/height-limiter/height-limiter.config.js +1 -1
- package/src/atoms/hr/hr.config.js +1 -1
- package/src/atoms/icon/icon.config.js +2 -2
- package/src/atoms/input/_input.scss +23 -16
- package/src/atoms/input/input.config.js +1 -1
- package/src/atoms/label/label.config.js +1 -1
- package/src/atoms/label/label.scss +11 -5
- package/src/atoms/logotype/_logotype.scss +3 -2
- package/src/atoms/logotype/logotype.config.js +3 -3
- package/src/atoms/main-menu/_main-menu.scss +67 -60
- package/src/atoms/main-menu/main-menu.config.js +1 -1
- package/src/atoms/meta/_meta.scss +44 -33
- package/src/atoms/meta/meta.config.js +2 -2
- package/src/atoms/paging/_paging.scss +27 -21
- package/src/atoms/paging/paging.config.js +1 -1
- package/src/atoms/password-toggle/_password-toggle.scss +9 -6
- package/src/atoms/password-toggle/password-toggle.config.js +1 -1
- package/src/atoms/progress/_progress.scss +19 -11
- package/src/atoms/progress/progress.config.js +1 -1
- package/src/atoms/quote/_quote.scss +17 -10
- package/src/atoms/quote/quote.config.js +1 -1
- package/src/atoms/radiobutton/_radiobutton.scss +33 -26
- package/src/atoms/radiobutton/radiobutton.config.js +1 -1
- package/src/atoms/range/_range.scss +46 -39
- package/src/atoms/range/range.config.js +1 -1
- package/src/atoms/rating/_rating.scss +11 -4
- package/src/atoms/rating/rating.config.js +1 -1
- package/src/atoms/ribbon/_ribbon.scss +17 -10
- package/src/atoms/ribbon/ribbon.config.js +1 -1
- package/src/atoms/select/_select.scss +18 -10
- package/src/atoms/select/select.config.js +1 -1
- package/src/atoms/skip/_skip.scss +9 -6
- package/src/atoms/skip/skip.config.js +1 -1
- package/src/atoms/spinner/_spinner.scss +4 -3
- package/src/atoms/spinner/spinner.config.js +1 -1
- package/src/atoms/tag/_tag.scss +26 -19
- package/src/atoms/tag/tag.config.js +1 -1
- package/src/atoms/textarea/_textarea.scss +22 -13
- package/src/atoms/textarea/textarea.config.js +1 -1
- package/src/atoms/toggle-button/toggle-button.config.js +1 -1
- package/src/atoms/tooltip/_tooltip.scss +28 -21
- package/src/atoms/tooltip/tooltip.config.js +1 -1
- package/src/base/_grid.scss +4 -4
- package/src/base/_normalize.scss +122 -120
- package/src/base/fonts/_fonts.scss +1 -1
- package/src/brandbook/goto10/goto10.config.js +1 -1
- package/src/brandbook/internetstiftelsen/bildman/303/251r/bildman/303/251r.config.js +1 -1
- package/src/brandbook/internetstiftelsen/identitet/identitet.config.js +1 -1
- package/src/brandbook/internetstiftelsen/tonalitet och spr/303/245kbruk/tonalitet och spr/303/245kbruk.config.js" +1 -1
- package/src/components.js +0 -2
- package/src/configurations/_bem.scss +30 -27
- package/src/configurations/_config.scss +24 -23
- package/src/configurations/_extends.scss +38 -34
- package/src/configurations/_functions.scss +25 -9
- package/src/configurations/_mixins.scss +23 -19
- package/src/configurations/_recaptcha.scss +2 -2
- package/src/configurations/_variables.scss +40 -46
- package/src/configurations/_wordpress.scss +69 -62
- package/src/configurations/colors/_background-colors.scss +3 -2
- package/src/configurations/colors/_colors-functions.scss +41 -39
- package/src/configurations/colors/_colors.scss +4 -4
- package/src/configurations/colors/_text-colors.scss +3 -2
- package/src/configurations/colors/_wordpress-colors.scss +3 -2
- package/src/configurations/colors/colors.config.js +1 -1
- package/src/configurations/favicon/favicon.config.js +1 -1
- package/src/configurations/forms/_fields.scss +28 -23
- package/src/configurations/grid/_grid.scss +33 -28
- package/src/configurations/grid/grid.config.js +1 -1
- package/src/configurations/icons.json +1 -1
- package/src/configurations/typography/_typography.scss +113 -105
- package/src/configurations/typography/readme.md +1 -1
- package/src/configurations/typography/typography.config.js +1 -1
- package/src/globals.scss +16 -18
- package/src/isolated-footer.scss +25 -25
- package/src/molecules/alert/_alert.scss +44 -35
- package/src/molecules/alert/alert.config.js +1 -1
- package/src/molecules/breadcrumb/_breadcrumb.scss +43 -35
- package/src/molecules/breadcrumb/breadcrumb.config.js +1 -1
- package/src/molecules/byline/_byline.scss +30 -21
- package/src/molecules/byline/byline.config.js +1 -1
- package/src/molecules/card/_card.scss +87 -77
- package/src/molecules/context-menu/_context-menu.scss +32 -15
- package/src/molecules/context-menu/context-menu.config.js +11 -11
- package/src/molecules/continue-video-guide/continue-video-guide.config.js +1 -1
- package/src/molecules/continue-video-guide/continue-video-guide.scss +37 -28
- package/src/molecules/cookie-disclaimer/cookie-disclaimer.config.js +1 -1
- package/src/molecules/cookie-disclaimer/cookie-disclaimer.scss +32 -23
- package/src/molecules/download/_download.scss +38 -30
- package/src/molecules/download/download.config.js +1 -1
- package/src/molecules/form/form.config.js +1 -1
- package/src/molecules/form-control/_form-control.scss +66 -58
- package/src/molecules/form-control/form-control.config.js +1 -1
- package/src/molecules/glider/_glider-course.scss +29 -23
- package/src/molecules/glider/_glider-hero.scss +112 -104
- package/src/molecules/glider/_glider.scss +36 -30
- package/src/molecules/glider/glider-hero.js +1 -3
- package/src/molecules/glider/glider.config.js +1 -1
- package/src/molecules/icon-overlay/_icon-overlay.scss +29 -20
- package/src/molecules/icon-overlay/icon-overlay.config.js +1 -1
- package/src/molecules/info-box/_info-box.scss +31 -22
- package/src/molecules/info-box/info-box.config.js +1 -1
- package/src/molecules/input-group/_input-group.scss +23 -13
- package/src/molecules/input-group/input-group.config.js +1 -1
- package/src/molecules/modal/_modal.scss +77 -65
- package/src/molecules/modal/modal.js +2 -2
- package/src/molecules/multi-select/_multi-select.scss +44 -33
- package/src/molecules/multi-select/multi-select.js +3 -3
- package/src/molecules/natural-language-form/_natural-language-form.scss +33 -23
- package/src/molecules/natural-language-form/natural-language-form.config.js +4 -4
- package/src/molecules/overview-navigation/_overview-navigation.scss +54 -45
- package/src/molecules/overview-navigation/overview-navigation.js +2 -2
- package/src/molecules/readspeaker/_readspeaker.scss +1 -1
- package/src/molecules/share/_share.scss +23 -15
- package/src/molecules/share/share.config.js +1 -1
- package/src/molecules/submenu/_submenu.scss +77 -69
- package/src/molecules/submenu/submenu.config.js +1 -1
- package/src/molecules/system-error/_system-error.scss +26 -17
- package/src/molecules/system-error/system-error.config.js +1 -1
- package/src/molecules/table/_table.scss +50 -42
- package/src/molecules/table/table.config.js +1 -1
- package/src/molecules/teaser-news-list/_teaser-news-list.scss +21 -12
- package/src/molecules/teaser-news-list/teaser-news-list.config.js +1 -1
- package/src/organisms/accordion/_accordion.scss +64 -54
- package/src/organisms/accordion/accordion.config.js +1 -1
- package/src/organisms/domain-search/_domain-search.scss +54 -45
- package/src/organisms/domain-search/domain-search.config.js +1 -1
- package/src/organisms/event-listing-item/_event-listing-item.scss +36 -26
- package/src/organisms/features-box/_features-box.scss +30 -19
- package/src/organisms/filter/_filter.scss +15 -10
- package/src/organisms/filter/filter.config.js +1 -1
- package/src/organisms/footer/_footer.scss +121 -111
- package/src/organisms/footer/footer.config.js +1 -1
- package/src/organisms/header/_header.scss +24 -14
- package/src/organisms/header/header.config.js +1 -1
- package/src/organisms/hero/_hero--bbk.scss +50 -38
- package/src/organisms/hero/_hero--dynamic-headline.scss +49 -39
- package/src/organisms/hero/_hero.scss +222 -207
- package/src/organisms/hero/hero.config.js +37 -38
- package/src/organisms/mailchimp/_mailchimp.scss +53 -43
- package/src/organisms/mailchimp/mailchimp.config.js +1 -1
- package/src/organisms/mailchimp/mailchimp.js +2 -1
- package/src/organisms/mega-menu/_mega-menu.scss +55 -45
- package/src/organisms/mega-menu/mega-menu.config.js +1 -1
- package/src/organisms/members-service-product/_members-service-product.scss +29 -18
- package/src/organisms/members-service-product/members-service-product.config.js +6 -8
- package/src/organisms/podcast/_podcast-episodes.scss +85 -75
- package/src/organisms/podcast/_podcast-player.scss +73 -64
- package/src/organisms/podcast/podcast.config.js +1 -1
- package/src/organisms/schedule/_schedule.scss +92 -82
- package/src/organisms/search/_search.scss +68 -58
- package/src/organisms/search-result/_search-result.scss +50 -40
- package/src/organisms/search-result/search-result.config.js +1 -1
- package/src/organisms/sections/_sections.scss +41 -31
- package/src/organisms/sections/sections.config.js +1 -1
- package/src/organisms/tabs/_tabs.scss +58 -46
- package/src/organisms/tabs/tabs.config.js +1 -1
- package/src/organisms/tabs/tabs.js +3 -2
- package/src/organisms/timeline/_timeline.scss +92 -81
- package/src/organisms/timeline/timeline.config.js +1 -1
- package/src/organisms/timeline/timeline.js +3 -2
- package/src/organisms/video-guide/VideoGuidePlayback.js +1 -1
- package/src/organisms/video-guide/_video-guide.scss +148 -138
- package/src/organisms/video-guide/video-guide.config.js +1 -1
- package/src/organisms/video-guide/video-guide.js +2 -2
- package/src/pages/animate-footer/animate-footer.config.js +181 -2
- package/src/pages/bredbandskollen/bredbandskollen.config.js +1 -1
- package/src/pages/conditional/conditional.config.js +1 -1
- package/src/pages/dark-mode/dark-mode.config.js +1 -1
- package/src/pages/internetguider/internetguider.config.js +1 -1
- package/src/pages/magazine/magazine.config.js +1 -1
- package/src/pages/mailchimp-newsletter/mailchimp-newsletter.config.js +1 -1
- package/src/pages/responsive-position/responsive-position.config.js +1 -1
- package/src/pages/search/search.config.js +1 -1
- package/src/pages/wordpress-blocks/wordpress-blocks.config.js +1 -1
- package/src/print.scss +1 -1
- package/src/structures/_article.scss +39 -28
- package/src/structures/_core-values.scss +14 -2
- package/src/structures/_manifest.scss +4 -4
- package/src/structures/_section.scss +32 -20
- package/src/structures/_site.scss +19 -7
- package/src/theme/_dark-mode.scss +14 -13
- package/src/theme/_theme.scss +29 -26
- package/src/utilities/_align.scss +1 -1
- package/src/utilities/_border.scss +5 -3
- package/src/utilities/_box-shadow.scss +5 -2
- package/src/utilities/_display.scss +1 -1
- package/src/utilities/_fill.scss +5 -4
- package/src/utilities/_flex.scss +1 -1
- package/src/utilities/_font-size.scss +6 -5
- package/src/utilities/_fonts.scss +6 -5
- package/src/utilities/_gutter.scss +3 -2
- package/src/utilities/_hide.scss +17 -15
- package/src/utilities/_icons.scss +41 -37
- package/src/utilities/_indent.scss +8 -6
- package/src/utilities/_links.scss +22 -18
- package/src/utilities/_lists.scss +19 -14
- package/src/utilities/_manifest.scss +27 -27
- package/src/utilities/_margin.scss +28 -25
- package/src/utilities/_misc.scss +3 -2
- package/src/utilities/_padding.scss +26 -23
- package/src/utilities/_position.scss +3 -2
- package/src/utilities/_show.scss +7 -6
- package/src/utilities/_text.scss +1 -1
- package/src/utilities/_vertical-align.scss +1 -1
- package/src/utilities/_wrap.scss +1 -1
- package/src/utilities/_z-index.scss +7 -6
- package/src/utilities/tab-highlighting/_tab-highlighting.scss +6 -5
- package/src/vendor/baseline/_plumber.scss +14 -13
- package/src/vendor/grid/_breakpoints.scss +17 -13
- package/src/vendor/grid/_flex.scss +8 -4
- package/src/vendor/grid/_functions.scss +9 -6
- package/src/vendor/grid/_grid-framework.scss +14 -9
- package/src/vendor/grid/_grid.scss +19 -16
- package/src/vendor/grid/_spacing.scss +8 -3
- package/src/atoms/toggle-high-contrast/readme.md +0 -6
- package/src/atoms/toggle-high-contrast/toggle-high-contrast.config.js +0 -8
- package/src/atoms/toggle-high-contrast/toggle-high-contrast.js +0 -10
- package/src/molecules/modal/modal-graph.js +0 -40
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
@charset
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
@use "sass:map";
|
|
3
|
+
@use "sass:math";
|
|
4
|
+
@use "sass:list";
|
|
5
|
+
@use '../../configurations/variables' as var;
|
|
6
|
+
@use '../../configurations/functions' as func;
|
|
7
|
+
@use 'breakpoints' as breakpoint;
|
|
8
|
+
@use 'grid' as m5;
|
|
2
9
|
|
|
3
10
|
// Framework grid generation
|
|
4
11
|
//
|
|
5
12
|
// Used to generate the correct number of grid classes given
|
|
6
13
|
// any value of `$grid-columns`.
|
|
7
14
|
|
|
8
|
-
@
|
|
9
|
-
|
|
10
|
-
@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
|
|
15
|
+
@mixin make-grid-columns($columns: var.$grid-columns, $gutter: var.$grid-gutter-width, $breakpoints: var.$grid-breakpoints) {
|
|
11
16
|
// Common properties for all breakpoints
|
|
12
17
|
%grid-column {
|
|
13
18
|
position: relative;
|
|
@@ -17,8 +22,8 @@
|
|
|
17
22
|
padding-left: math.div($gutter, 2);
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
@each $breakpoint in map
|
|
21
|
-
$infix: breakpoint-infix($breakpoint, $breakpoints);
|
|
25
|
+
@each $breakpoint in map.keys($breakpoints) {
|
|
26
|
+
$infix: breakpoint.breakpoint-infix($breakpoint, $breakpoints);
|
|
22
27
|
|
|
23
28
|
// Allow columns to stretch full width below their breakpoints
|
|
24
29
|
@for $i from 1 through $columns {
|
|
@@ -32,7 +37,7 @@
|
|
|
32
37
|
@extend %grid-column;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
@include bp-up($breakpoint, $breakpoints) {
|
|
40
|
+
@include breakpoint.bp-up($breakpoint, $breakpoints) {
|
|
36
41
|
// Provide basic `.grid-{bp}` classes for equal-width flexbox columns
|
|
37
42
|
.grid#{$infix} {
|
|
38
43
|
flex-basis: 0;
|
|
@@ -48,7 +53,7 @@
|
|
|
48
53
|
|
|
49
54
|
@for $i from 1 through $columns {
|
|
50
55
|
.grid#{$infix}-#{$i} {
|
|
51
|
-
@include make-col($i, $columns);
|
|
56
|
+
@include m5.make-col($i, $columns);
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -62,7 +67,7 @@
|
|
|
62
67
|
@for $i from 0 through ($columns - 1) {
|
|
63
68
|
@if not ($infix == '' and $i == 0) { // Avoid emitting useless .offset-0
|
|
64
69
|
.offset#{$infix}-#{$i} {
|
|
65
|
-
@include make-col-offset($i, $columns); }
|
|
70
|
+
@include m5.make-col-offset($i, $columns); }
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
@charset
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
@use "sass:list";
|
|
4
|
+
@use '../../configurations/variables' as var;
|
|
5
|
+
@use '../../configurations/functions' as func;
|
|
6
|
+
@use 'breakpoints' as breakpoint;
|
|
2
7
|
|
|
3
8
|
/// Grid system
|
|
4
9
|
//
|
|
5
10
|
// Generate semantic grid columns with these mixins.
|
|
6
11
|
|
|
7
|
-
@use "sass:math";
|
|
8
|
-
|
|
9
12
|
@mixin make-container() {
|
|
10
13
|
width: 100%;
|
|
11
14
|
margin-right: auto;
|
|
12
15
|
margin-left: auto;
|
|
13
|
-
padding-right: math.div(
|
|
14
|
-
padding-left: math.div(
|
|
16
|
+
padding-right: math.div(var.$grid-gutter-width, 2);
|
|
17
|
+
padding-left: math.div(var.$grid-gutter-width, 2);
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
// For each breakpoint, define the maximum width of the container in a media query
|
|
18
|
-
@mixin make-container-max-widths($max-widths:
|
|
21
|
+
@mixin make-container-max-widths($max-widths: var.$container-max-widths, $breakpoints: var.$grid-breakpoints) {
|
|
19
22
|
@each $breakpoint, $container-max-width in $max-widths {
|
|
20
|
-
@include bp-up($breakpoint, $breakpoints) {
|
|
23
|
+
@include breakpoint.bp-up($breakpoint, $breakpoints) {
|
|
21
24
|
max-width: $container-max-width;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -26,8 +29,8 @@
|
|
|
26
29
|
@mixin make-row() {
|
|
27
30
|
display: flex;
|
|
28
31
|
flex-wrap: wrap;
|
|
29
|
-
margin-right: math.div(
|
|
30
|
-
margin-left: math.div(
|
|
32
|
+
margin-right: math.div(var.$grid-gutter-width, -2);
|
|
33
|
+
margin-left: math.div(var.$grid-gutter-width, -2);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
@mixin make-col-ready() {
|
|
@@ -37,18 +40,18 @@
|
|
|
37
40
|
// later on to override this initial width.
|
|
38
41
|
width: 100%;
|
|
39
42
|
min-height: 1px; // Prevent collapsing
|
|
40
|
-
padding-right: math.div(
|
|
41
|
-
padding-left: math.div(
|
|
43
|
+
padding-right: math.div(var.$grid-gutter-width, 2);
|
|
44
|
+
padding-left: math.div(var.$grid-gutter-width, 2);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
@mixin make-col($size, $columns:
|
|
45
|
-
flex: 0 0 percentage(math.div($size, $columns));
|
|
47
|
+
@mixin make-col($size, $columns: var.$grid-columns) {
|
|
48
|
+
flex: 0 0 math.percentage(math.div($size, $columns));
|
|
46
49
|
// Add a `max-width` to ensure content within each column does not blow out
|
|
47
50
|
// the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
|
|
48
51
|
// do not appear to require this.
|
|
49
|
-
max-width: percentage(math.div($size, $columns));
|
|
52
|
+
max-width: math.percentage(math.div($size, $columns));
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
@mixin make-col-offset($size, $columns:
|
|
53
|
-
margin-left: percentage(math.div($size, $columns));
|
|
55
|
+
@mixin make-col-offset($size, $columns: var.$grid-columns) {
|
|
56
|
+
margin-left: math.percentage(math.div($size, $columns));
|
|
54
57
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use '../../configurations/variables' as var;
|
|
3
|
+
@use '../../configurations/functions' as func;
|
|
4
|
+
@use 'breakpoints' as breakpoint;
|
|
5
|
+
|
|
6
|
+
@each $breakpoint in map.keys(var.$grid-breakpoints) {
|
|
7
|
+
@include breakpoint.bp-up($breakpoint) {
|
|
8
|
+
$infix: breakpoint.breakpoint-infix($breakpoint, var.$grid-breakpoints);
|
|
4
9
|
|
|
5
10
|
// Some special margin utils
|
|
6
11
|
.m#{$infix}-auto { margin: auto !important; }
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Toggle High Contrast
|
|
2
|
-
When clicked, this component triggers the class ```high-contrast``` on the body-element which activated high contrast styles based on that class. The background is made dark and the text is made white.
|
|
3
|
-
|
|
4
|
-
When activated, the site is not supposed to "look good". It's suppose to make text easier to read.
|
|
5
|
-
|
|
6
|
-
The javascript is activated by this class: ```js-toggle-high-contrast```
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const element = document.querySelector('.js-toggle-high-contrast');
|
|
2
|
-
|
|
3
|
-
function classToggle() {
|
|
4
|
-
const body = document.querySelector('body');
|
|
5
|
-
body.classList.toggle('high-contrast');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (element) {
|
|
9
|
-
element.addEventListener('click', classToggle);
|
|
10
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Close overlay on graph modal
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const graphModals = document.querySelectorAll('.js-modal-graph');
|
|
6
|
-
const graphModalButtons = document.querySelectorAll('.js-modal-graph-button');
|
|
7
|
-
|
|
8
|
-
const addMultipleListeners = (el, types, listener, options, useCapture) => {
|
|
9
|
-
types.forEach((type) => el.addEventListener(type, listener, options, useCapture));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function closeOverlay(graphModalButton) {
|
|
13
|
-
// Close overlay button on 'click' on itself
|
|
14
|
-
graphModalButton.addEventListener('click', () => {
|
|
15
|
-
graphModalButton.classList.add('is-hidden');
|
|
16
|
-
graphModalButton.blur();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
[].forEach.call(graphModals, (graphModal) => {
|
|
20
|
-
const closeButton = graphModal.querySelector('.js-toggle-modal');
|
|
21
|
-
|
|
22
|
-
closeButton.addEventListener('click', () => {
|
|
23
|
-
graphModalButton.classList.remove('is-hidden');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Close overlay button on 'wheel', 'scroll', 'touchstart' on modal container
|
|
27
|
-
addMultipleListeners(
|
|
28
|
-
graphModal,
|
|
29
|
-
['wheel', 'scroll', 'touchstart'],
|
|
30
|
-
() => {
|
|
31
|
-
graphModalButton.classList.add('is-hidden');
|
|
32
|
-
console.log('fire!');
|
|
33
|
-
},
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (graphModalButtons && graphModals) {
|
|
39
|
-
[].forEach.call(graphModalButtons, closeOverlay);
|
|
40
|
-
}
|