@bonniernews/dn-design-system-web 3.0.0-alpha.2 → 3.0.0-alpha.21
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 +166 -0
- package/README.md +1 -1
- package/assets/article-image/article-image.njk +34 -0
- package/assets/article-image/article-image.scss +6 -0
- package/assets/form-field/form-field.scss +5 -9
- package/components/article-body-image/README.md +42 -0
- package/components/article-body-image/article-body-image.njk +19 -0
- package/components/article-body-image/article-body-image.scss +8 -0
- package/components/article-top-image/README.md +40 -0
- package/components/article-top-image/article-top-image.njk +19 -0
- package/components/article-top-image/article-top-image.scss +6 -0
- package/components/badge/badge.scss +5 -9
- package/components/blocked-content/blocked-content.scss +6 -6
- package/components/buddy-menu/buddy-menu.scss +14 -21
- package/components/button/button.scss +22 -19
- package/components/button-toggle/button-toggle.scss +22 -21
- package/components/byline/byline.scss +11 -8
- package/components/checkbox/checkbox.scss +10 -14
- package/components/disclaimer/disclaimer.scss +26 -12
- package/components/divider/divider.scss +1 -1
- package/components/factbox/factbox.scss +11 -9
- package/components/footer/footer.scss +14 -20
- package/components/icon-button/icon-button.scss +3 -3
- package/components/icon-button-toggle/icon-button-toggle.scss +3 -3
- package/components/image-caption/README.md +38 -0
- package/components/image-caption/image-caption.njk +25 -0
- package/components/image-caption/image-caption.scss +15 -0
- package/components/list-item/list-item.scss +9 -9
- package/components/quote/quote.scss +2 -2
- package/components/radio-button/radio-button.scss +10 -15
- package/components/switch/switch.scss +2 -2
- package/components/text-button/text-button.scss +8 -13
- package/components/text-button-toggle/text-button-toggle.scss +4 -10
- package/components/text-input/text-input.scss +20 -24
- package/components/thematic-break/thematic-break.scss +1 -1
- package/components/video-caption/README.md +37 -0
- package/components/video-caption/video-caption.njk +26 -0
- package/components/video-caption/video-caption.scss +18 -0
- package/foundations/helpers/README-links.md +1 -1
- package/foundations/helpers/README-spacing.md +48 -10
- package/foundations/helpers/spacing.scss +3 -1
- package/foundations/typography/fontDefinitions.scss +106 -60
- package/foundations/variables/colorsCssVariables.scss +3 -0
- package/foundations/variables/colorsDnDarkTokens.scss +4 -1
- package/foundations/variables/colorsDnLightTokens.scss +3 -0
- package/foundations/variables/spacingComponentList.scss +10 -0
- package/foundations/variables/spacingLayout.scss +1 -0
- package/foundations/variables/spacingLayoutLargeScreen.scss +3 -9
- package/foundations/variables/spacingLayoutList.scss +9 -0
- package/foundations/variables/typographyTokensList.scss +31 -30
- package/foundations/variables/typographyTokensScreenLarge.scss +167 -161
- package/foundations/variables/typographyTokensScreenSmall.scss +189 -183
- package/package.json +2 -2
- package/tokens/colors-css-variables.json +3 -0
- package/tokens/spacing-component-list.json +12 -0
- package/tokens/spacing-layout-list.json +11 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)
|
|
2
|
+
- Storybook: [ImageCaption > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-image-imagecaption-web--image-caption)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# ImageCaption
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|caption | String | no | | | Ex "Detta är en bildtext" |
|
|
13
|
+
|imageType | String | no | | | Type of image. Ex "Foto" |
|
|
14
|
+
|author | String | no | | | Ex "Paul Hansen" |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|forcePx | Bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
18
|
+
|
|
19
|
+
## Minimum requirement example
|
|
20
|
+
|
|
21
|
+
### Nunjucks
|
|
22
|
+
|
|
23
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
{% from '@bonniernews/dn-design-system-web/components/image-caption/image-caption.njk' import ImageCaption %}
|
|
27
|
+
|
|
28
|
+
{{ ImageCaption({
|
|
29
|
+
caption: "En bildtext",
|
|
30
|
+
imageType: "Foto",
|
|
31
|
+
author: "Paul Hansen",
|
|
32
|
+
})}}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### SCSS
|
|
36
|
+
```scss
|
|
37
|
+
@use "@bonniernews/dn-design-system-web/components/image-caption/image-caption";
|
|
38
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% macro ImageCaption(params) %}
|
|
2
|
+
{% set macroClassName = "ds-image-caption" %}
|
|
3
|
+
{% set additionalClasses = [] %}
|
|
4
|
+
|
|
5
|
+
{% if params.classNames %}
|
|
6
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
7
|
+
{% endif %}
|
|
8
|
+
|
|
9
|
+
{% if params.forcePx %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
11
|
+
{% endif %}
|
|
12
|
+
|
|
13
|
+
{% set classes = macroClassName + " " + additionalClasses | join(" ") %}
|
|
14
|
+
|
|
15
|
+
<figcaption class="{{ classes }}" {{- params.attributes | safe }}>
|
|
16
|
+
{% if params.caption %}
|
|
17
|
+
<span aria-hidden="true">{{ params.caption | safe }}</span>
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% if params.author %}
|
|
20
|
+
<span class="ds-article-image__credits">
|
|
21
|
+
{%- if params.imageType %}{{ params.imageType | capitalize }}: {% endif %}{{ params.author -}}
|
|
22
|
+
</span>
|
|
23
|
+
{% endif %}
|
|
24
|
+
</figcaption>
|
|
25
|
+
{% endmacro %}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-image-caption {
|
|
4
|
+
@include ds-typography($ds-typography-functional-body01regular);
|
|
5
|
+
margin-top: ds-spacing-component($ds-sc-x2);
|
|
6
|
+
color: $ds-color-text-primary;
|
|
7
|
+
|
|
8
|
+
@at-root .ds-force-px#{&} {
|
|
9
|
+
@include ds-typography($ds-typography-functional-body01regular, true);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
> .ds-article-image__credits {
|
|
13
|
+
color: $ds-color-text-primary-02;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -33,7 +33,7 @@ $ds-list-item__icon-size: 24px;
|
|
|
33
33
|
align-items: center;
|
|
34
34
|
justify-content: space-between;
|
|
35
35
|
position: relative;
|
|
36
|
-
padding: ds-spacing-component(x4 outer);
|
|
36
|
+
padding: ds-spacing-component($ds-sc-x4 $ds-sc-outer);
|
|
37
37
|
width: 100%;
|
|
38
38
|
|
|
39
39
|
&::before {
|
|
@@ -99,17 +99,17 @@ $ds-list-item__icon-size: 24px;
|
|
|
99
99
|
@include ds-typography($ds-typography-functional-body01regular, true);
|
|
100
100
|
}
|
|
101
101
|
color: $ds-color-text-primary-02;
|
|
102
|
-
margin-left: ds-spacing-component(x4);
|
|
102
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.ds-list-item__icon-left {
|
|
106
106
|
display: inline-flex;
|
|
107
|
-
margin-right: ds-spacing-component(x4);
|
|
107
|
+
margin-right: ds-spacing-component($ds-sc-x4);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.ds-list-item__icon-right {
|
|
111
111
|
display: inline-flex;
|
|
112
|
-
margin-left: ds-spacing-component(x4);
|
|
112
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
@include ds-hover() {
|
|
@@ -143,10 +143,10 @@ $ds-list-item__icon-size: 24px;
|
|
|
143
143
|
&.ds-list-item--accordion-active + .ds-list-item__accordion-inner::after {
|
|
144
144
|
content: "";
|
|
145
145
|
height: ds-metrics-border-width(x1);
|
|
146
|
-
width: calc(100% - (ds-spacing-component(x4) * 2));
|
|
146
|
+
width: calc(100% - (ds-spacing-component($ds-sc-x4) * 2));
|
|
147
147
|
background-color: $ds-color-border-primary;
|
|
148
148
|
position: absolute;
|
|
149
|
-
left: ds-spacing-component(x4);
|
|
149
|
+
left: ds-spacing-component($ds-sc-x4);
|
|
150
150
|
bottom: 0;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -240,13 +240,13 @@ $ds-list-item__icon-size: 24px;
|
|
|
240
240
|
cursor: default;
|
|
241
241
|
.ds-list-item__inner {
|
|
242
242
|
display: flex;
|
|
243
|
-
padding: 0 0 0 ds-spacing-component(outer);
|
|
243
|
+
padding: 0 0 0 ds-spacing-component($ds-sc-outer);
|
|
244
244
|
}
|
|
245
245
|
.ds-list-item__titles {
|
|
246
|
-
padding: ds-spacing-component(x4) 0;
|
|
246
|
+
padding: ds-spacing-component($ds-sc-x4) 0;
|
|
247
247
|
}
|
|
248
248
|
.ds-btn-toggle {
|
|
249
|
-
margin:
|
|
249
|
+
margin: ds-spacing-component(0 $ds-sc-outer 0 $ds-sc-x4);
|
|
250
250
|
}
|
|
251
251
|
a {
|
|
252
252
|
@include ds-link($ds-link-list);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
color: $ds-color-text-primary;
|
|
6
6
|
margin: 0;
|
|
7
7
|
@include ds-spacing-layout(
|
|
8
|
-
gap-vertical-static-medium 0 gap-vertical-static-large
|
|
8
|
+
$ds-sl-gap-vertical-static-medium 0 $ds-sl-gap-vertical-static-large
|
|
9
9
|
);
|
|
10
10
|
position: relative;
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
height: 8px;
|
|
20
20
|
color: $ds-color-component-brand;
|
|
21
21
|
background: currentColor;
|
|
22
|
-
margin: ds-spacing-component(0 0 x2);
|
|
22
|
+
margin: ds-spacing-component(0 0 $ds-sc-x2);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&--culture .ds-quote__border {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
3
|
-
@use "../../foundations/helpers/mediaQueries.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
7
2
|
@use "../../foundations/icons/icon.scss" as *;
|
|
8
3
|
@use "../../assets/form-field/form-field.scss" as *;
|
|
9
4
|
|
|
@@ -21,7 +16,7 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
21
16
|
justify-content: center;
|
|
22
17
|
color: $ds-color-text-primary;
|
|
23
18
|
position: relative;
|
|
24
|
-
padding: ds-spacing-component(x3);
|
|
19
|
+
padding: ds-spacing-component($ds-sc-x3);
|
|
25
20
|
&::before {
|
|
26
21
|
content: "";
|
|
27
22
|
position: absolute;
|
|
@@ -32,11 +27,11 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
32
27
|
bottom: 0;
|
|
33
28
|
}
|
|
34
29
|
.ds-radio-btn__text {
|
|
35
|
-
margin: ds-spacing-component(0 0 0 x2, rem);
|
|
30
|
+
margin: ds-spacing-component(0 0 0 $ds-sc-x2, rem);
|
|
36
31
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
37
32
|
@at-root .ds-force-px#{&} {
|
|
38
33
|
@include ds-typography($ds-typography-functional-body02regular, true);
|
|
39
|
-
margin: ds-spacing-component(0 0 0 x2);
|
|
34
|
+
margin: ds-spacing-component(0 0 0 $ds-sc-x2);
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
37
|
.ds-radio-btn__icon {
|
|
@@ -100,13 +95,13 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
100
95
|
}
|
|
101
96
|
|
|
102
97
|
.ds-form-field__error-message {
|
|
103
|
-
margin-top: ds-spacing-component(x1);
|
|
104
|
-
padding: 0 ds-spacing-component(x3) ds-spacing-component(x3);
|
|
98
|
+
margin-top: ds-spacing-component($ds-sc-x1);
|
|
99
|
+
padding: 0 ds-spacing-component($ds-sc-x3) ds-spacing-component($ds-sc-x3);
|
|
105
100
|
|
|
106
101
|
.ds-icon {
|
|
107
|
-
margin: 0 ds-spacing-component(x2
|
|
102
|
+
margin: 0 ds-spacing-component($ds-sc-x2 0 $ds-sc-x8, rem);
|
|
108
103
|
@at-root .ds-force-px#{&} {
|
|
109
|
-
margin: ds-spacing-component(0 x2 0 x8);
|
|
104
|
+
margin: ds-spacing-component(0 $ds-sc-x2 0 $ds-sc-x8);
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
107
|
}
|
|
@@ -115,11 +110,11 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
115
110
|
|
|
116
111
|
.ds-radio-btn--condensed {
|
|
117
112
|
.ds-radio-btn__inner {
|
|
118
|
-
padding: ds-spacing-component(x1);
|
|
113
|
+
padding: ds-spacing-component($ds-sc-x1);
|
|
119
114
|
}
|
|
120
115
|
&.ds-form-field__error .ds-form-field__error-message,
|
|
121
116
|
.invalid .ds-form-field__error-message {
|
|
122
|
-
padding: 0 ds-spacing-component(x1) ds-spacing-component(x1);
|
|
117
|
+
padding: 0 ds-spacing-component($ds-sc-x1) ds-spacing-component($ds-sc-x1);
|
|
123
118
|
}
|
|
124
119
|
}
|
|
125
120
|
|
|
@@ -12,13 +12,13 @@ $ds-switch__container-width: 44px;
|
|
|
12
12
|
align-items: flex-start;
|
|
13
13
|
|
|
14
14
|
.ds-switch__inner {
|
|
15
|
-
padding: ds-spacing-component(x3 0);
|
|
15
|
+
padding: ds-spacing-component($ds-sc-x3 0);
|
|
16
16
|
cursor: pointer;
|
|
17
17
|
display: inline-flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
justify-content: center;
|
|
20
20
|
.ds-switch__meta {
|
|
21
|
-
margin: ds-spacing-component(0 x2 0 0);
|
|
21
|
+
margin: ds-spacing-component(0 $ds-sc-x2 0 0);
|
|
22
22
|
color: $ds-color-text-primary-02;
|
|
23
23
|
@include ds-typography($ds-typography-functional-body01regular);
|
|
24
24
|
@at-root .ds-force-px#{&} {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
3
|
-
@use "../../foundations/helpers/mediaQueries.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
7
|
-
@use "../../foundations/helpers/loading.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
8
2
|
@use "../../foundations/icons/icon.scss" as *;
|
|
9
3
|
@use "../spinner/spinner.scss" as *;
|
|
10
4
|
|
|
@@ -54,7 +48,7 @@ $ds-text-btn__icon-size: 24px;
|
|
|
54
48
|
.ds-text-btn__inner {
|
|
55
49
|
background-color: transparent;
|
|
56
50
|
border-radius: ds-metrics-border-radius(x1);
|
|
57
|
-
padding: ds-spacing-component(x3);
|
|
51
|
+
padding: ds-spacing-component($ds-sc-x3);
|
|
58
52
|
position: relative;
|
|
59
53
|
&::before {
|
|
60
54
|
content: "";
|
|
@@ -95,6 +89,7 @@ $ds-text-btn__icon-size: 24px;
|
|
|
95
89
|
&,
|
|
96
90
|
& .ds-text-btn__inner {
|
|
97
91
|
width: 100%;
|
|
92
|
+
box-sizing: border-box;
|
|
98
93
|
}
|
|
99
94
|
}
|
|
100
95
|
|
|
@@ -108,7 +103,7 @@ $ds-text-btn__icon-size: 24px;
|
|
|
108
103
|
display: flex;
|
|
109
104
|
height: ds-px-to-rem($ds-text-btn__icon-size);
|
|
110
105
|
width: ds-px-to-rem($ds-text-btn__icon-size);
|
|
111
|
-
margin: ds-spacing-component(0 0 0 x2);
|
|
106
|
+
margin: ds-spacing-component(0 0 0 $ds-sc-x2);
|
|
112
107
|
color: $ds-color-icon-primary;
|
|
113
108
|
svg {
|
|
114
109
|
fill: currentColor;
|
|
@@ -129,19 +124,19 @@ $ds-text-btn__icon-size: 24px;
|
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
.ds-text-btn--icon-left .ds-text-btn__inner {
|
|
132
|
-
padding: ds-spacing-component(x3 x3 x3 x2);
|
|
127
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x3 $ds-sc-x3 $ds-sc-x2);
|
|
133
128
|
flex-direction: row-reverse;
|
|
134
129
|
.ds-icon {
|
|
135
|
-
margin: ds-spacing-component(0 x2 0 0);
|
|
130
|
+
margin: ds-spacing-component(0 $ds-sc-x2 0 0);
|
|
136
131
|
}
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
.ds-text-btn--icon-right .ds-text-btn__inner {
|
|
140
|
-
padding: ds-spacing-component(x3 x2 x3 x3);
|
|
135
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x2 $ds-sc-x3 $ds-sc-x3);
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
.ds-text-btn--condensed .ds-text-btn__inner {
|
|
144
|
-
padding: ds-spacing-component(x1);
|
|
139
|
+
padding: ds-spacing-component($ds-sc-x1);
|
|
145
140
|
}
|
|
146
141
|
|
|
147
142
|
@include ds-mq-only-breakpoint(mobile) {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
3
|
-
@use "../../foundations/helpers/mediaQueries.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
7
|
-
@use "../../foundations/helpers/loading.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
8
2
|
@use "../../foundations/icons/icon.scss" as *;
|
|
9
3
|
@use "../spinner/spinner.scss" as *;
|
|
10
4
|
|
|
@@ -57,7 +51,7 @@ $ds-text-btn-toggle__icon-size: 24px;
|
|
|
57
51
|
justify-content: center;
|
|
58
52
|
background-color: transparent;
|
|
59
53
|
border-radius: ds-metrics-border-radius(x1);
|
|
60
|
-
padding: ds-spacing-component(x3 x3 x3 x2);
|
|
54
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x3 $ds-sc-x3 $ds-sc-x2);
|
|
61
55
|
position: relative;
|
|
62
56
|
&::before {
|
|
63
57
|
content: "";
|
|
@@ -74,7 +68,7 @@ $ds-text-btn-toggle__icon-size: 24px;
|
|
|
74
68
|
display: flex;
|
|
75
69
|
height: ds-px-to-rem($ds-text-btn-toggle__icon-size);
|
|
76
70
|
width: ds-px-to-rem($ds-text-btn-toggle__icon-size);
|
|
77
|
-
margin: ds-spacing-component(0 x2 0 0);
|
|
71
|
+
margin: ds-spacing-component(0 $ds-sc-x2 0 0);
|
|
78
72
|
color: $ds-color-icon-primary;
|
|
79
73
|
svg {
|
|
80
74
|
fill: currentColor;
|
|
@@ -128,5 +122,5 @@ $ds-text-btn-toggle__icon-size: 24px;
|
|
|
128
122
|
}
|
|
129
123
|
|
|
130
124
|
.ds-text-btn-toggle--condensed .ds-text-btn-toggle__inner {
|
|
131
|
-
padding: ds-spacing-component(x1);
|
|
125
|
+
padding: ds-spacing-component($ds-sc-x1);
|
|
132
126
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
3
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
6
2
|
@use "../../assets/form-field/form-field.scss" as *;
|
|
7
3
|
@use "../../foundations/icons/icon.scss" as *;
|
|
8
4
|
@use "../icon-button/icon-button.scss" as *;
|
|
9
5
|
|
|
10
6
|
$ds-text-input-toggle-btn__width: 32px;
|
|
11
7
|
$ds-text-input-toggle-btn__area: (
|
|
12
|
-
$ds-text-input-toggle-btn__width + ds-spacing-component(x2)
|
|
8
|
+
$ds-text-input-toggle-btn__width + ds-spacing-component($ds-sc-x2)
|
|
13
9
|
);
|
|
14
10
|
|
|
15
11
|
.ds-form-field__error {
|
|
@@ -19,7 +15,7 @@ $ds-text-input-toggle-btn__area: (
|
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
.ds-text-input {
|
|
22
|
-
padding-top: ds-px-to-rem(ds-spacing-component(x2));
|
|
18
|
+
padding-top: ds-px-to-rem(ds-spacing-component($ds-sc-x2));
|
|
23
19
|
position: relative;
|
|
24
20
|
color: $ds-color-text-primary;
|
|
25
21
|
}
|
|
@@ -30,8 +26,8 @@ $ds-text-input-toggle-btn__area: (
|
|
|
30
26
|
color: $ds-color-text-primary;
|
|
31
27
|
background-color: $ds-color-component-secondary;
|
|
32
28
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
/* stylelint-disable-next-line */
|
|
30
|
+
padding: ds-px-to-rem(ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1)) ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1);
|
|
35
31
|
border: solid ds-metrics-border-width(x1) $ds-color-border-primary-02;
|
|
36
32
|
border-radius: ds-metrics-border-radius(x1);
|
|
37
33
|
margin: 0;
|
|
@@ -59,9 +55,9 @@ $ds-text-input-toggle-btn__area: (
|
|
|
59
55
|
|
|
60
56
|
&:focus {
|
|
61
57
|
padding: ds-px-to-rem(
|
|
62
|
-
ds-spacing-component(x4) - ds-metrics-border-width(x2)
|
|
58
|
+
ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2)
|
|
63
59
|
)
|
|
64
|
-
ds-spacing-component(x4) - ds-metrics-border-width(x2);
|
|
60
|
+
ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2);
|
|
65
61
|
border-color: $ds-color-border-primary-03;
|
|
66
62
|
border-width: ds-metrics-border-width(x2);
|
|
67
63
|
|
|
@@ -87,18 +83,18 @@ $ds-text-input-toggle-btn__area: (
|
|
|
87
83
|
|
|
88
84
|
.ds-text-input__label {
|
|
89
85
|
position: absolute;
|
|
90
|
-
top: ds-px-to-rem(ds-spacing-component(x6));
|
|
91
|
-
left: ds-spacing-component(x4);
|
|
86
|
+
top: ds-px-to-rem(ds-spacing-component($ds-sc-x6));
|
|
87
|
+
left: ds-spacing-component($ds-sc-x4);
|
|
92
88
|
z-index: 1;
|
|
93
89
|
transition: font-size 0.1s ease-in, top 0.1s ease-in;
|
|
94
90
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
95
91
|
&::before {
|
|
96
92
|
content: "";
|
|
97
|
-
width: calc(100% + ds-spacing-component(x2));
|
|
98
|
-
left: -#{ds-spacing-component(x1)};
|
|
93
|
+
width: calc(100% + ds-spacing-component($ds-sc-x2));
|
|
94
|
+
left: -#{ds-spacing-component($ds-sc-x1)};
|
|
99
95
|
height: ds-metrics-border-width(x1);
|
|
100
96
|
position: absolute;
|
|
101
|
-
top: ds-px-to-rem(ds-spacing-component(x2));
|
|
97
|
+
top: ds-px-to-rem(ds-spacing-component($ds-sc-x2));
|
|
102
98
|
z-index: -1;
|
|
103
99
|
background-color: transparent; // for animation
|
|
104
100
|
transition: background-color 0.2s ease-in-out;
|
|
@@ -107,8 +103,8 @@ $ds-text-input-toggle-btn__area: (
|
|
|
107
103
|
|
|
108
104
|
.ds-icon-btn.ds-text-input__password-toggle {
|
|
109
105
|
position: absolute;
|
|
110
|
-
top: ds-px-to-rem(ds-spacing-component(x5));
|
|
111
|
-
right: ds-spacing-component(x1);
|
|
106
|
+
top: ds-px-to-rem(ds-spacing-component($ds-sc-x5));
|
|
107
|
+
right: ds-spacing-component($ds-sc-x1);
|
|
112
108
|
z-index: 1;
|
|
113
109
|
min-width: 0;
|
|
114
110
|
min-height: 0;
|
|
@@ -116,12 +112,12 @@ $ds-text-input-toggle-btn__area: (
|
|
|
116
112
|
|
|
117
113
|
.ds-force-px {
|
|
118
114
|
&.ds-text-input {
|
|
119
|
-
padding-top: ds-spacing-component(x2);
|
|
115
|
+
padding-top: ds-spacing-component($ds-sc-x2);
|
|
120
116
|
}
|
|
121
117
|
|
|
122
118
|
.ds-text-input__input {
|
|
123
119
|
@include ds-typography($ds-typography-functional-body02regular, true);
|
|
124
|
-
padding: ds-spacing-component(x4) - ds-metrics-border-width(x1);
|
|
120
|
+
padding: ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1);
|
|
125
121
|
|
|
126
122
|
&.password-toggle {
|
|
127
123
|
padding-right: $ds-text-input-toggle-btn__area;
|
|
@@ -140,19 +136,19 @@ $ds-text-input-toggle-btn__area: (
|
|
|
140
136
|
}
|
|
141
137
|
|
|
142
138
|
&:focus {
|
|
143
|
-
padding: ds-spacing-component(x4) - ds-metrics-border-width(x2);
|
|
139
|
+
padding: ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2);
|
|
144
140
|
}
|
|
145
141
|
}
|
|
146
142
|
|
|
147
143
|
.ds-text-input__label {
|
|
148
144
|
@include ds-typography($ds-typography-functional-body02regular, true);
|
|
149
|
-
top: ds-spacing-component(x6);
|
|
145
|
+
top: ds-spacing-component($ds-sc-x6);
|
|
150
146
|
&::before {
|
|
151
|
-
top: ds-spacing-component(x2);
|
|
147
|
+
top: ds-spacing-component($ds-sc-x2);
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
.ds-text-input__password-toggle {
|
|
156
|
-
top: ds-spacing-component(x5);
|
|
152
|
+
top: ds-spacing-component($ds-sc-x5);
|
|
157
153
|
}
|
|
158
154
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/video-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/video-caption)
|
|
2
|
+
- Storybook (PROD): [VideoCaption > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-videocaption-web--video-caption)
|
|
3
|
+
- Storybook (LATEST): [VideoCaption > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-article-components-videocaption-web--video-caption)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# VideoCaption
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|caption | String | no | | | |
|
|
14
|
+
|duration | String | no | | | |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
|
|
18
|
+
|
|
19
|
+
## Minimum requirement example
|
|
20
|
+
|
|
21
|
+
### Nunjucks
|
|
22
|
+
|
|
23
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
{% from '@bonniernews/dn-design-system-web/components/video-caption/video-caption.njk' import VideoCaption %}
|
|
27
|
+
|
|
28
|
+
{{ VideoCaption({
|
|
29
|
+
caption: "Tre år har gått sedan terrordåden i Paris.",
|
|
30
|
+
duration: "47 sek"
|
|
31
|
+
}) }}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### SCSS
|
|
35
|
+
```scss
|
|
36
|
+
@use "@bonniernews/dn-design-system-web/components/video-caption/video-caption";
|
|
37
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro VideoCaption(params) %}
|
|
4
|
+
{%- set componentClassName = "ds-video-caption" %}
|
|
5
|
+
{%- set additionalClasses = [] %}
|
|
6
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
7
|
+
{%- if params.forcePx %}
|
|
8
|
+
{%- set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
9
|
+
{% endif %}
|
|
10
|
+
{%- if params.classNames %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
12
|
+
{% endif%}
|
|
13
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
14
|
+
<figcaption class="{{ classes }}" {{- attributes | safe }}>
|
|
15
|
+
{%- if params.duration -%}
|
|
16
|
+
<span class="{{ componentClassName + '__duration'}}" aria-label="Videon är {{ params.duration }} lång">
|
|
17
|
+
{{- params.duration -}}
|
|
18
|
+
</span>
|
|
19
|
+
{%- endif %}
|
|
20
|
+
{% if params.caption -%}
|
|
21
|
+
<span class="{{ componentClassName + '__text'}}">
|
|
22
|
+
{{- params.caption -}}
|
|
23
|
+
</span>
|
|
24
|
+
{% endif -%}
|
|
25
|
+
</figcaption>
|
|
26
|
+
{% endmacro %}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-video-caption {
|
|
4
|
+
@include ds-typography($ds-typography-functional-body01regular);
|
|
5
|
+
color: $ds-color-text-primary;
|
|
6
|
+
|
|
7
|
+
.ds-video-caption__duration {
|
|
8
|
+
@include ds-typography($ds-typography-functional-body01bold);
|
|
9
|
+
margin-right: ds-spacing-component($ds-sc-x1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@at-root .ds-force-px#{&} {
|
|
13
|
+
@include ds-typography($ds-typography-functional-body01regular, true);
|
|
14
|
+
.ds-video-caption__duration {
|
|
15
|
+
@include ds-typography($ds-typography-functional-body01bold, true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
|
|
6
6
|
# Spacing
|
|
7
7
|
|
|
8
|
+
## use sass variable
|
|
9
|
+
To avoid silent breaking changes use sass variable instead of raw token name.
|
|
10
|
+
|
|
11
|
+
Ex: `margin: ds-spacing-component($ds-sc-x1 0 $ds-sc-x4)`
|
|
12
|
+
|
|
13
|
+
Ex: `@include ds-spacing-layout($ds-sl-page-horizontal auto, padding-top)`
|
|
14
|
+
|
|
15
|
+
By using sass variables (instead of token name directly), if a spacing token used in scss is removed sass will not compile - which is a good thing!
|
|
16
|
+
|
|
17
|
+
By using sass variables for spacing tokens you will see which tokens are available through auto complete.
|
|
18
|
+
|
|
19
|
+
Variables with `$ds-sc-` prefix are available for `ds-spacing-component()`
|
|
20
|
+
|
|
21
|
+
Variables with `$ds-sl-` prefix are available for `ds-spacing-layout()`
|
|
22
|
+
|
|
8
23
|
## ds-spacing-component | function
|
|
9
24
|
|
|
10
25
|
Use for space _inside_ a component (or atom).
|
|
@@ -22,8 +37,15 @@ Dynamic spacings are static and are _not_ wrapped in any media query, the functi
|
|
|
22
37
|
```scss
|
|
23
38
|
@use "@bonniernews/dn-design-system-web/foundations/helpers/forward.helpers.scss" as *;
|
|
24
39
|
|
|
25
|
-
.test {
|
|
26
|
-
margin: ds-spacing-component(x1 x2 0
|
|
40
|
+
.test-1 {
|
|
41
|
+
margin: ds-spacing-component($ds-sc-x1 $ds-sc-x2 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Outputs:
|
|
45
|
+
4px 8px 0
|
|
46
|
+
|
|
47
|
+
.test-2 {
|
|
48
|
+
margin: ds-spacing-component($ds-sc-x1 $ds-sc-x2 0, px, true);
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
// Outputs:
|
|
@@ -41,31 +63,47 @@ This mixin returns `property: value` wrapped in media query.
|
|
|
41
63
|
|parameter | type | required | options | default | description |
|
|
42
64
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
43
65
|
|units | String | yes | one or more spacing tokens or `auto` or `0` | | Ex. 0 page-horizontal |
|
|
44
|
-
|sizeUnit | String | no | px, rem, em | px | |
|
|
45
66
|
|property | String | no | padding, margin | padding | Use padding for layout spacing to avoid collapsing margins|
|
|
67
|
+
|sizeUnit | String | no | px, rem, em | px | |
|
|
46
68
|
|negative | bool | no | true, false | false | Applies to all units except for `auto` and `0` |
|
|
47
69
|
|
|
48
70
|
```scss
|
|
49
71
|
@use "@bonniernews/dn-design-system-web/foundations/helpers/forward.helpers.scss" as *;
|
|
50
72
|
|
|
51
|
-
.test {
|
|
73
|
+
.test-1 {
|
|
74
|
+
@include ds-spacing-layout($ds-sl-page-top-small, padding-top);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Outputs:
|
|
78
|
+
@media (max-width: 1024px) {
|
|
79
|
+
.test-1 {
|
|
80
|
+
padding-top: 16px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
@media (min-width: 1025px) {
|
|
84
|
+
.test-1 {
|
|
85
|
+
padding-top: 32px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.test-2 {
|
|
52
90
|
@include ds-spacing-layout(
|
|
53
|
-
0 page-horizontal,
|
|
54
|
-
px,
|
|
91
|
+
0 $ds-sl-page-horizontal,
|
|
55
92
|
margin,
|
|
93
|
+
px,
|
|
56
94
|
true
|
|
57
95
|
);
|
|
58
96
|
}
|
|
59
97
|
|
|
60
98
|
// Outputs:
|
|
61
99
|
@media (max-width: 1024px) {
|
|
62
|
-
.test {
|
|
63
|
-
|
|
100
|
+
.test-2 {
|
|
101
|
+
margin: 0 -16px;
|
|
64
102
|
}
|
|
65
103
|
}
|
|
66
104
|
@media (min-width: 1025px) {
|
|
67
|
-
.test {
|
|
68
|
-
|
|
105
|
+
.test-2 {
|
|
106
|
+
margin: 0 -32px;
|
|
69
107
|
}
|
|
70
108
|
}
|
|
71
109
|
```
|