@helsenorge/designsystem-react 10.6.1 → 10.6.3
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/CHANGELOG.md +15 -0
- package/components/AnchorLink/styles.module.scss +9 -7
- package/components/Avatar/styles.module.scss +9 -9
- package/components/Badge/styles.module.scss +9 -9
- package/components/Button/styles.module.scss +71 -77
- package/components/Checkbox/styles.module.scss +104 -104
- package/components/Chip/styles.module.scss +22 -21
- package/components/Close/styles.module.scss +5 -5
- package/components/DictionaryTrigger/styles.module.scss +5 -5
- package/components/Drawer/styles.module.scss +27 -27
- package/components/Dropdown/styles.module.scss +55 -55
- package/components/Duolist/styles.module.scss +4 -5
- package/components/EmptyState/styles.module.scss +16 -16
- package/components/ErrorWrapper/styles.module.scss +2 -2
- package/components/Expander/styles.module.scss +53 -53
- package/components/ExpanderHierarchy/expander.module.scss +35 -35
- package/components/ExpanderHierarchy/styles.module.scss +5 -4
- package/components/ExpanderList/index.js +12 -5
- package/components/ExpanderList/index.js.map +1 -1
- package/components/ExpanderList/styles.module.scss +32 -32
- package/components/EyebrowHeader/styles.module.scss +2 -0
- package/components/FormGroup/styles.module.scss +9 -9
- package/components/FormLayout/styles.module.scss +5 -4
- package/components/HelpBubble/styles.module.scss +14 -14
- package/components/HelpPanel/styles.module.scss +2 -2
- package/components/HelpQuestion/styles.module.scss +20 -20
- package/components/HighlightPanel/styles.module.scss +20 -20
- package/components/HorizontalScroll/styles.module.scss +3 -4
- package/components/Input/styles.module.scss +14 -14
- package/components/Label/styles.module.scss +16 -16
- package/components/LinkList/styles.module.scss +35 -35
- package/components/ListHeader/styles.module.scss +8 -8
- package/components/Loader/styles.module.scss +14 -14
- package/components/MaxCharacters/styles.module.scss +12 -12
- package/components/Modal/styles.module.scss +49 -49
- package/components/NotificationPanel/styles.module.scss +40 -40
- package/components/Panel/styles.module.scss +60 -60
- package/components/PanelList/styles.module.scss +6 -6
- package/components/PopMenu/styles.module.scss +16 -16
- package/components/PopOver/styles.module.scss +15 -14
- package/components/PopOver/styles.module.scss.d.ts +3 -0
- package/components/Progressbar/styles.module.scss +4 -4
- package/components/PromoPanel/styles.module.scss +31 -31
- package/components/RadioButton/styles.module.scss +100 -100
- package/components/Select/styles.module.scss +23 -23
- package/components/ServiceMessage/styles.module.scss +48 -48
- package/components/SharingStatus/styles.module.scss +13 -13
- package/components/Slider/styles.module.scss +25 -25
- package/components/Spacer/styles.module.scss +14 -14
- package/components/StatusDot/styles.module.scss +24 -24
- package/components/Step/styles.module.scss +3 -3
- package/components/StepButtons/styles.module.scss +11 -11
- package/components/Stepper/styles.module.scss +16 -24
- package/components/StickyNote/styles.module.scss +3 -3
- package/components/Table/styles.module.scss +31 -31
- package/components/Tabs/TabList/styles.module.scss +2 -2
- package/components/Tabs/TabPanel/styles.module.scss +7 -7
- package/components/Tabs/styles.module.scss +3 -3
- package/components/Tag/styles.module.scss +16 -16
- package/components/TagList/styles.module.scss +4 -4
- package/components/Textarea/styles.module.scss +9 -9
- package/components/Tile/styles.module.scss +31 -31
- package/components/Title/styles.module.scss +8 -8
- package/components/Toggle/styles.module.scss +18 -18
- package/components/Tooltip/TooltipWord/styles.module.scss +4 -4
- package/components/Trigger/styles.module.scss +21 -21
- package/components/Validation/styles.module.scss +11 -11
- package/hooks/useBreakpoint.js +3 -1
- package/hooks/useBreakpoint.js.map +1 -1
- package/package.json +1 -1
- package/scss/_body.scss +6 -5
- package/scss/_breakpoints.scss +2 -2
- package/scss/_font-mixins.scss +22 -22
- package/scss/_fonts.scss +2 -0
- package/scss/_input.scss +51 -54
- package/scss/_print.scss +5 -5
- package/scss/_reset.scss +1 -1
- package/scss/helsenorge.scss +7 -7
- package/scss/layout.module.scss +2 -2
- package/scss/typography.module.scss +46 -47
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@import '../../scss/supernova/styles/colors
|
|
2
|
+
@import '../../scss/font-settings';
|
|
3
|
+
@import '../../scss/palette';
|
|
4
|
+
@import '../../scss/spacers';
|
|
5
|
+
@import '../../scss/breakpoints';
|
|
6
|
+
@import '../../scss/screen-reader';
|
|
7
|
+
@import '../../scss/supernova/styles/colors';
|
|
8
8
|
|
|
9
9
|
.tile {
|
|
10
10
|
// Referanse for grandparent selection i underklassene lenger nede
|
|
@@ -12,23 +12,23 @@
|
|
|
12
12
|
|
|
13
13
|
display: flex;
|
|
14
14
|
width: inherit;
|
|
15
|
-
padding:
|
|
15
|
+
padding: getSpacer(2xs) getSpacer(2xs) getSpacer(xs);
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
justify-content: center;
|
|
18
18
|
background-color: var(--core-color-white);
|
|
19
|
-
color:
|
|
19
|
+
color: $black;
|
|
20
20
|
text-decoration: none;
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
border: 1px solid var(--color-base-border-blueberry);
|
|
23
23
|
outline: none;
|
|
24
24
|
|
|
25
|
-
@media (min-width: map.get(
|
|
26
|
-
padding:
|
|
25
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
26
|
+
padding: getSpacer(l) getSpacer(m) getSpacer(l) getSpacer(s);
|
|
27
27
|
justify-content: flex-start;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
@media print {
|
|
31
|
-
border: 1px solid
|
|
31
|
+
border: 1px solid $black;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&--fixed {
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&--compact {
|
|
40
|
-
padding:
|
|
40
|
+
padding: getSpacer(2xs) getSpacer(2xs) getSpacer(xs);
|
|
41
41
|
|
|
42
|
-
@media (min-width: map.get(
|
|
43
|
-
padding:
|
|
42
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
43
|
+
padding: getSpacer(s) getSpacer(m) getSpacer(s) getSpacer(s);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
&--highlighted {
|
|
62
|
-
background-color:
|
|
63
|
-
border-color:
|
|
64
|
-
color:
|
|
62
|
+
background-color: $blueberry500;
|
|
63
|
+
border-color: $blueberry500;
|
|
64
|
+
color: $white;
|
|
65
65
|
|
|
66
66
|
&:hover,
|
|
67
67
|
&:active {
|
|
68
|
-
background-color:
|
|
69
|
-
border-color:
|
|
68
|
+
background-color: $blueberry700;
|
|
69
|
+
border-color: $blueberry700;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
&:focus-visible {
|
|
@@ -78,26 +78,26 @@
|
|
|
78
78
|
overflow-wrap: break-word;
|
|
79
79
|
word-wrap: break-word;
|
|
80
80
|
word-break: break-word;
|
|
81
|
-
font-size: font-
|
|
81
|
+
font-size: $font-size-sm;
|
|
82
82
|
text-align: center;
|
|
83
83
|
line-height: 1.74rem;
|
|
84
84
|
font-weight: 400;
|
|
85
|
-
margin:
|
|
85
|
+
margin: getSpacer(3xs) 0 0;
|
|
86
86
|
|
|
87
|
-
@media (min-width: map.get(
|
|
87
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
88
88
|
text-align: left;
|
|
89
89
|
font-weight: 600;
|
|
90
|
-
font-size: font-
|
|
90
|
+
font-size: $font-size-md;
|
|
91
91
|
line-height: 1.625rem;
|
|
92
|
-
margin:
|
|
92
|
+
margin: getSpacer(s) 0 0 getSpacer(2xs);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
&--compact {
|
|
96
|
-
margin: 0 0 0
|
|
96
|
+
margin: 0 0 0 getSpacer(3xs);
|
|
97
97
|
text-align: left;
|
|
98
98
|
|
|
99
|
-
@media (min-width: map.get(
|
|
100
|
-
margin-left:
|
|
99
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
100
|
+
margin-left: getSpacer(2xs);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -113,11 +113,11 @@
|
|
|
113
113
|
&__description {
|
|
114
114
|
font-size: 1.125rem;
|
|
115
115
|
line-height: 1.75rem;
|
|
116
|
-
margin:
|
|
116
|
+
margin: getSpacer(2xs) 0 0 getSpacer(2xs);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
&__children {
|
|
120
|
-
margin:
|
|
120
|
+
margin: getSpacer(s) 0 0 getSpacer(2xs);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
flex-direction: column;
|
|
127
127
|
align-items: center;
|
|
128
128
|
|
|
129
|
-
@media (min-width: map.get(
|
|
129
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
130
130
|
align-items: start;
|
|
131
131
|
|
|
132
132
|
@media print {
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
&--compact {
|
|
138
138
|
flex-direction: row;
|
|
139
139
|
align-items: center;
|
|
140
|
-
padding-right:
|
|
140
|
+
padding-right: getSpacer(s);
|
|
141
141
|
padding-bottom: 0;
|
|
142
142
|
|
|
143
143
|
svg {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@
|
|
1
|
+
@import '../../scss/font-mixins';
|
|
2
2
|
|
|
3
3
|
.title {
|
|
4
4
|
overflow-wrap: break-word;
|
|
@@ -7,30 +7,30 @@
|
|
|
7
7
|
margin-right: 0;
|
|
8
8
|
|
|
9
9
|
&--feature {
|
|
10
|
-
@include
|
|
10
|
+
@include title-feature;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
&--title1 {
|
|
14
|
-
@include
|
|
14
|
+
@include title1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&--title2 {
|
|
18
|
-
@include
|
|
18
|
+
@include title2;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&--title3 {
|
|
22
|
-
@include
|
|
22
|
+
@include title3;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&--title4 {
|
|
26
|
-
@include
|
|
26
|
+
@include title4;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&--title5 {
|
|
30
|
-
@include
|
|
30
|
+
@include title5;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&--title6 {
|
|
34
|
-
@include
|
|
34
|
+
@include title6;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@import '../../scss/
|
|
2
|
+
@import '../../scss/spacers';
|
|
3
|
+
@import '../../scss/breakpoints';
|
|
4
|
+
@import '../../scss/palette';
|
|
5
|
+
@import '../../scss/font-settings';
|
|
6
|
+
@import '../../scss/supernova/styles/colors';
|
|
7
|
+
@import '../../scss/font-mixins';
|
|
8
8
|
|
|
9
9
|
.toggle-container {
|
|
10
10
|
display: flex;
|
|
@@ -22,39 +22,39 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&__label {
|
|
25
|
-
@include
|
|
25
|
+
@include label;
|
|
26
26
|
|
|
27
27
|
color: var(--core-color-neutral-900);
|
|
28
|
-
margin-left:
|
|
28
|
+
margin-left: getSpacer(xs);
|
|
29
29
|
|
|
30
|
-
@media (min-width: map.get(
|
|
31
|
-
margin-left:
|
|
30
|
+
@media (min-width: map.get($grid-breakpoints, sm)) {
|
|
31
|
+
margin-left: getSpacer(s);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&__text--subdued {
|
|
35
|
-
@include
|
|
35
|
+
@include label-subdued;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&--toggle-right {
|
|
39
39
|
margin-left: 0;
|
|
40
|
-
margin-right:
|
|
40
|
+
margin-right: getSpacer(xs);
|
|
41
41
|
|
|
42
|
-
@media (min-width: map.get(
|
|
43
|
-
margin-right:
|
|
42
|
+
@media (min-width: map.get($grid-breakpoints, sm)) {
|
|
43
|
+
margin-right: getSpacer(s);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
&__sublabel {
|
|
49
|
-
font-size: font-
|
|
49
|
+
font-size: $font-size-xs;
|
|
50
50
|
line-height: 1.25rem;
|
|
51
51
|
color: var(--core-color-neutral-800);
|
|
52
52
|
margin-left: 3.9rem;
|
|
53
53
|
text-align: left;
|
|
54
54
|
|
|
55
|
-
@media (min-width: map.get(
|
|
56
|
-
font-size: font-
|
|
57
|
-
line-height:
|
|
55
|
+
@media (min-width: map.get($grid-breakpoints, sm)) {
|
|
56
|
+
font-size: $font-size-sm;
|
|
57
|
+
line-height: $lineheight-size-xs;
|
|
58
58
|
text-align: left;
|
|
59
59
|
margin-left: 4.1rem;
|
|
60
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@import '../../../scss/palette';
|
|
2
|
+
@import '../../../scss/spacers';
|
|
3
3
|
|
|
4
4
|
.word {
|
|
5
5
|
all: unset;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
cursor: help;
|
|
9
9
|
|
|
10
10
|
// bruker border istedet for text-decoration for å komme rundt text-decoraton-thickness begrensninger i safari
|
|
11
|
-
border-bottom: 0.2rem dotted
|
|
11
|
+
border-bottom: 0.2rem dotted $plum400;
|
|
12
12
|
line-height: 1.4rem;
|
|
13
13
|
|
|
14
14
|
&:focus-visible {
|
|
15
|
-
box-shadow: 0 0 0
|
|
15
|
+
box-shadow: 0 0 0 getSpacer(4xs) $black;
|
|
16
16
|
outline: none;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
2
|
+
@import '../../scss/palette';
|
|
3
|
+
@import '../../scss/icon';
|
|
4
4
|
|
|
5
5
|
$trigger-medium-size: 24.18px;
|
|
6
6
|
$trigger-medium-click-area: 44px;
|
|
@@ -24,8 +24,8 @@ $trigger-large-size: 30.61px;
|
|
|
24
24
|
&--medium {
|
|
25
25
|
height: $trigger-medium-size;
|
|
26
26
|
width: $trigger-medium-size;
|
|
27
|
-
margin-left: calc((map.get(icon
|
|
28
|
-
margin-right: calc((map.get(icon
|
|
27
|
+
margin-left: calc((map.get($icon-sizes, xs) - $trigger-medium-size) / 2);
|
|
28
|
+
margin-right: calc((map.get($icon-sizes, xs) - $trigger-medium-size) / 2);
|
|
29
29
|
|
|
30
30
|
&::after {
|
|
31
31
|
// Increase the clickable area
|
|
@@ -41,8 +41,8 @@ $trigger-large-size: 30.61px;
|
|
|
41
41
|
&--large {
|
|
42
42
|
height: $trigger-large-size;
|
|
43
43
|
width: $trigger-large-size;
|
|
44
|
-
margin-left: calc((map.get(icon
|
|
45
|
-
margin-right: calc((map.get(icon
|
|
44
|
+
margin-left: calc((map.get($icon-sizes, sm) - $trigger-large-size) / 2);
|
|
45
|
+
margin-right: calc((map.get($icon-sizes, sm) - $trigger-large-size) / 2);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
$variant-map: (
|
|
@@ -52,56 +52,56 @@ $trigger-large-size: 30.61px;
|
|
|
52
52
|
|
|
53
53
|
@each $variant, $color in $variant-map {
|
|
54
54
|
&--#{$variant} {
|
|
55
|
-
box-shadow: inset 0 0 0 1.6px map.get(palette
|
|
55
|
+
box-shadow: inset 0 0 0 1.6px map.get($palette-map, #{$color}600);
|
|
56
56
|
|
|
57
57
|
&:hover,
|
|
58
58
|
&#{$trigger}--hovered {
|
|
59
|
-
box-shadow: inset 0 0 0 1.6px map.get(palette
|
|
60
|
-
background-color: rgba(map.get(palette
|
|
59
|
+
box-shadow: inset 0 0 0 1.6px map.get($palette-map, #{$color}800);
|
|
60
|
+
background-color: rgba(map.get($palette-map, #{$color}600), 0.1);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&:focus-visible {
|
|
64
|
-
box-shadow: inset 0 0 0 1.6px
|
|
65
|
-
outline: 1.6px solid
|
|
64
|
+
box-shadow: inset 0 0 0 1.6px $black;
|
|
65
|
+
outline: 1.6px solid $black;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
&#{$trigger}--selected {
|
|
69
|
-
box-shadow: inset 0 0 0 1.6px map.get(palette
|
|
70
|
-
background-color: rgba(map.get(palette
|
|
69
|
+
box-shadow: inset 0 0 0 1.6px map.get($palette-map, #{$color}800);
|
|
70
|
+
background-color: rgba(map.get($palette-map, #{$color}600), 0.1);
|
|
71
71
|
|
|
72
72
|
&:hover,
|
|
73
73
|
&#{$trigger}--hovered {
|
|
74
|
-
background-color: rgba(map.get(palette
|
|
74
|
+
background-color: rgba(map.get($palette-map, #{$color}600), 0.2);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
&:focus {
|
|
78
|
-
background-color: rgba(map.get(palette
|
|
78
|
+
background-color: rgba(map.get($palette-map, #{$color}600), 0.1);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
&--ondark {
|
|
85
|
-
box-shadow: inset 0 0 0 1.6px
|
|
85
|
+
box-shadow: inset 0 0 0 1.6px $white;
|
|
86
86
|
|
|
87
87
|
&:hover {
|
|
88
|
-
background-color: rgba(
|
|
88
|
+
background-color: rgba($plum50, 0.2);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
&:focus-visible {
|
|
92
|
-
outline: 1.6px solid
|
|
92
|
+
outline: 1.6px solid $white;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
&#{$trigger}--selected {
|
|
96
|
-
background-color: rgba(
|
|
96
|
+
background-color: rgba($plum50, 0.1);
|
|
97
97
|
|
|
98
98
|
&:hover,
|
|
99
99
|
&#{$trigger}--hovered {
|
|
100
|
-
background-color: rgba(
|
|
100
|
+
background-color: rgba($plum50, 0.2);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
&:focus-visible {
|
|
104
|
-
background-color: rgba(
|
|
104
|
+
background-color: rgba($plum50, 0.1);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
2
|
+
@import '../../scss/breakpoints';
|
|
3
|
+
@import '../../scss/spacers';
|
|
4
|
+
@import '../../scss/palette';
|
|
5
|
+
@import '../../scss/font-settings';
|
|
6
6
|
|
|
7
7
|
.validation {
|
|
8
8
|
&__error-wrapper {
|
|
9
|
-
margin-bottom:
|
|
9
|
+
margin-bottom: getSpacer(2xs);
|
|
10
10
|
|
|
11
|
-
@media (min-width: map.get(
|
|
12
|
-
margin-bottom:
|
|
11
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
12
|
+
margin-bottom: getSpacer(m);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
&__summary {
|
|
17
|
-
color:
|
|
17
|
+
color: $cherry600;
|
|
18
18
|
|
|
19
19
|
&--visible {
|
|
20
|
-
margin:
|
|
20
|
+
margin: getSpacer(l) 0 getSpacer(s);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&__errors {
|
|
25
|
-
font-size: font-
|
|
25
|
+
font-size: $font-size-sm;
|
|
26
26
|
font-weight: 600;
|
|
27
27
|
|
|
28
28
|
&--visible {
|
|
29
|
-
margin:
|
|
29
|
+
margin: getSpacer(l) 0 getSpacer(s);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
package/hooks/useBreakpoint.js
CHANGED
|
@@ -20,7 +20,9 @@ function getCurrentBreakpoint() {
|
|
|
20
20
|
return (matched == null ? void 0 : matched.breakpoint) ?? Breakpoint.xxs;
|
|
21
21
|
}
|
|
22
22
|
const useBreakpoint = () => {
|
|
23
|
-
const [breakpoint, setBreakpoint] = useState(
|
|
23
|
+
const [breakpoint, setBreakpoint] = useState(
|
|
24
|
+
typeof window.matchMedia !== "undefined" ? getCurrentBreakpoint() : Breakpoint.xxs
|
|
25
|
+
);
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
const handleMediaQueryEvent = (event) => {
|
|
26
28
|
switch (event.media) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const handleMediaQueryEvent = (event: MediaQueryListEvent): void => {\n switch (event.media) {\n case screen.xl:\n setBreakpoint(event.matches ? Breakpoint.xl : Breakpoint.lg);\n return;\n case screen.lg:\n setBreakpoint(event.matches ? Breakpoint.lg : Breakpoint.md);\n return;\n case screen.md:\n setBreakpoint(event.matches ? Breakpoint.md : Breakpoint.sm);\n return;\n case screen.sm:\n setBreakpoint(event.matches ? Breakpoint.sm : Breakpoint.xs);\n return;\n case screen.xs:\n setBreakpoint(event.matches ? Breakpoint.xs : Breakpoint.xxs);\n return;\n default:\n setBreakpoint(Breakpoint.xxs);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const mediaQueryList = Object.entries(screen).map(([_size, mediaQuery]) => {\n const mq = window.matchMedia(mediaQuery);\n // iOS <=13 har ikke støtte for addEventListener/removeEventListener på MediaQueryList,\n // men har støtte for addListener\n if (mq.addEventListener) {\n mq.addEventListener('change', handleMediaQueryEvent);\n } else if (mq.addListener) {\n mq.addListener(handleMediaQueryEvent);\n }\n return mq;\n });\n\n return (): void => {\n mediaQueryList.forEach(mq => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handleMediaQueryEvent);\n } else if (mq.removeListener) {\n mq.removeListener(handleMediaQueryEvent);\n }\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"names":["Breakpoint"],"mappings":";;AAIY,IAAA,cAAL,CAAKA,gBAAL;AACLA,cAAAA,YAAA,KAAM,IAAA,YAAY,GAAlB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AANUA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AASZ,SAAS,uBAAmC;AAG1C,QAAM,iBAAiB,OAAO,QAAQ,MAAM,EACzC,QACA,EAAA,IAAI,CAAC,CAAC,MAAM,UAAU,MAAM;AACpB,WAAA;AAAA,MACL,YAAY,WAAW,IAA+B;AAAA,MACtD,IAAI,OAAO,WAAW,UAAU;AAAA,IAClC;AAAA,EAAA,CACD;AAEH,QAAM,UAAU,eAAe,KAAK,CAAS,UAAA,MAAM,GAAG,OAAO;AACtD,UAAA,mCAAS,eAAc,WAAW;AAC3C;AAEO,MAAM,gBAAgB,MAAkB;AACvC,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,OAAO,OAAO,eAAe,cAAc,qBAAA,IAAyB,WAAW;AAAA,EACjF;AAEA,YAAU,MAAM;AACR,UAAA,wBAAwB,CAAC,UAAqC;AAClE,cAAQ,MAAM,OAAO;AAAA,QACnB,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,GAAG;AAC5D;AAAA,QACF;AACE,wBAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IAElC;AAGM,UAAA,iBAAiB,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,UAAU,MAAM;AACnE,YAAA,KAAK,OAAO,WAAW,UAAU;AAGvC,UAAI,GAAG,kBAAkB;AACpB,WAAA,iBAAiB,UAAU,qBAAqB;AAAA,MAAA,WAC1C,GAAG,aAAa;AACzB,WAAG,YAAY,qBAAqB;AAAA,MAAA;AAE/B,aAAA;AAAA,IAAA,CACR;AAED,WAAO,MAAY;AACjB,qBAAe,QAAQ,CAAM,OAAA;AAC3B,YAAI,GAAG,qBAAqB;AACvB,aAAA,oBAAoB,UAAU,qBAAqB;AAAA,QAAA,WAC7C,GAAG,gBAAgB;AAC5B,aAAG,eAAe,qBAAqB;AAAA,QAAA;AAAA,MACzC,CACD;AAAA,IACH;AAAA,EACF,GAAG,EAAE;AAEE,SAAA;AACT;"}
|
package/package.json
CHANGED
package/scss/_body.scss
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
2
|
+
@import './palette';
|
|
3
|
+
@import './breakpoints';
|
|
4
|
+
@import './font-mixins';
|
|
4
5
|
|
|
5
6
|
body {
|
|
6
7
|
font-family: 'Source Sans Pro', Arial, Verdana, sans-serif;
|
|
7
|
-
background-color:
|
|
8
|
-
color:
|
|
8
|
+
background-color: $white;
|
|
9
|
+
color: $black;
|
|
9
10
|
|
|
10
|
-
@include
|
|
11
|
+
@include body;
|
|
11
12
|
}
|