@bonniernews/dn-design-system-web 3.0.0-alpha.7 → 3.0.0-alpha.71
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 +571 -0
- package/assets/article-image/article-image.njk +11 -10
- package/assets/article-image/article-image.scss +1 -15
- package/assets/form-field/form-field.njk +2 -2
- package/assets/form-field/form-field.scss +2 -6
- package/assets/teaser/teaser.scss +75 -0
- package/components/article-body-image/README.md +2 -2
- package/components/article-body-image/article-body-image.njk +1 -5
- package/components/article-top-image/README.md +2 -2
- package/components/article-top-image/article-top-image.njk +1 -5
- package/components/article-top-image/article-top-image.scss +1 -1
- package/components/badge/badge.scss +1 -5
- package/components/buddy-menu/buddy-menu.scss +1 -8
- package/components/button/button.njk +38 -43
- package/components/button/button.scss +6 -1
- package/components/button-toggle/button-toggle.js +2 -0
- package/components/button-toggle/button-toggle.njk +36 -36
- package/components/button-toggle/button-toggle.scss +6 -1
- package/components/byline/byline.njk +2 -2
- package/components/byline/byline.scss +1 -3
- package/components/checkbox/checkbox.njk +3 -3
- package/components/checkbox/checkbox.scss +8 -9
- package/components/disclaimer/disclaimer.njk +2 -2
- package/components/disclaimer/disclaimer.scss +25 -11
- package/components/factbox/README.md +2 -2
- package/components/factbox/factbox.njk +9 -11
- package/components/factbox/factbox.scss +6 -37
- package/components/footer/footer.scss +2 -8
- package/components/icon-button/README.md +2 -1
- package/components/icon-button/icon-button.njk +4 -4
- package/components/icon-button/icon-button.scss +5 -2
- package/components/icon-button-toggle/icon-button-toggle.js +2 -0
- package/components/icon-button-toggle/icon-button-toggle.njk +28 -36
- package/components/icon-button-toggle/icon-button-toggle.scss +5 -2
- package/components/icon-sprite/README.md +51 -0
- package/components/icon-sprite/icon-sprite.njk +12 -0
- package/components/icon-sprite/icon-sprite.scss +12 -0
- package/components/icon-with-wrapper/README.md +9 -2
- package/components/icon-with-wrapper/icon-with-wrapper.njk +2 -2
- package/components/icon-with-wrapper/icon-with-wrapper.scss +2 -1
- 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.njk +5 -5
- package/components/list-item/list-item.scss +1 -3
- package/components/pictogram/README.md +39 -0
- package/components/pictogram/pictogram.njk +30 -0
- package/components/pictogram/pictogram.scss +54 -0
- package/components/quote/README.md +1 -2
- package/components/quote/quote.njk +6 -8
- package/components/quote/quote.scss +1 -14
- package/components/radio-button/radio-button.njk +3 -3
- package/components/radio-button/radio-button.scss +8 -10
- package/components/spinner/spinner.njk +19 -23
- package/components/spinner/spinner.scss +4 -1
- package/components/teaser-dot/README.md +34 -0
- package/components/teaser-dot/teaser-dot.njk +24 -0
- package/components/teaser-dot/teaser-dot.scss +39 -0
- package/components/teaser-image/README.md +40 -0
- package/components/teaser-image/teaser-image.njk +21 -0
- package/components/teaser-image/teaser-image.scss +21 -0
- package/components/teaser-large/README.md +51 -0
- package/components/teaser-large/teaser-large.njk +93 -0
- package/components/teaser-large/teaser-large.scss +174 -0
- package/components/teaser-onsite/README.md +53 -0
- package/components/teaser-onsite/teaser-onsite.njk +45 -0
- package/components/teaser-onsite/teaser-onsite.scss +35 -0
- package/components/teaser-package/README.md +42 -0
- package/components/teaser-package/teaser-package.njk +36 -0
- package/components/teaser-package/teaser-package.scss +112 -0
- package/components/teaser-right-now/README.md +37 -0
- package/components/teaser-right-now/teaser-right-now.njk +28 -0
- package/components/teaser-right-now/teaser-right-now.scss +16 -0
- package/components/teaser-slideshow/README.md +42 -0
- package/components/teaser-slideshow/teaser-slideshow.njk +38 -0
- package/components/teaser-slideshow/teaser-slideshow.scss +35 -0
- package/components/teaser-split/README-container.md +40 -0
- package/components/teaser-split/README.md +48 -0
- package/components/teaser-split/teaser-split.njk +93 -0
- package/components/teaser-split/teaser-split.scss +77 -0
- package/components/teaser-standard/README.md +49 -0
- package/components/teaser-standard/teaser-standard.njk +81 -0
- package/components/teaser-standard/teaser-standard.scss +38 -0
- package/components/teaser-tipsa/README.md +41 -0
- package/components/teaser-tipsa/teaser-tipsa.njk +31 -0
- package/components/teaser-tipsa/teaser-tipsa.scss +23 -0
- package/components/text-button/text-button.njk +34 -37
- package/components/text-button/text-button.scss +12 -10
- package/components/text-button-toggle/text-button-toggle.js +2 -0
- package/components/text-button-toggle/text-button-toggle.njk +30 -33
- package/components/text-button-toggle/text-button-toggle.scss +10 -10
- package/components/text-input/text-input.scss +3 -8
- package/components/video-caption/README.md +1 -1
- package/components/video-caption/video-caption.njk +12 -6
- package/components/vip-badge/README.md +35 -0
- package/components/vip-badge/vip-badge.njk +23 -0
- package/components/vip-badge/vip-badge.scss +54 -0
- package/foundations/colors.scss +31 -0
- package/foundations/helpers/README-links.md +1 -1
- package/foundations/helpers/colors.scss +2 -0
- package/foundations/helpers/links.scss +14 -6
- package/foundations/icons/icon.njk +167 -143
- package/foundations/icons/sprite.njk +1 -0
- package/foundations/icons/sprite.svg +1 -0
- package/foundations/icons/svg/download.svg +3 -0
- package/foundations/icons/svg/filter_list.svg +3 -0
- package/foundations/icons/svg/pause.svg +3 -0
- package/foundations/icons/svg/vip.svg +3 -0
- package/foundations/typography/fontDefinitions.scss +82 -67
- package/foundations/variables/colorsCssVariables.scss +5 -0
- package/foundations/variables/colorsDnDarkTokens.scss +6 -1
- package/foundations/variables/colorsDnLightTokens.scss +7 -2
- package/foundations/variables/spacingLayout.scss +6 -1
- package/foundations/variables/spacingLayoutLargeScreen.scss +5 -0
- package/foundations/variables/spacingLayoutList.scss +5 -0
- package/foundations/variables/typographyTokensScreenLarge.scss +87 -87
- package/foundations/variables/typographyTokensScreenSmall.scss +114 -114
- package/package.json +2 -2
- package/tokens/colors-css-variables.json +5 -0
- package/tokens/spacing-layout-list.json +6 -1
- package/foundations/icons/icon-sprite.svg +0 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/pictogram](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/pictogram)
|
|
2
|
+
- Storybook: [Pictogram > Web](https://designsystem.dn.se/?path=/story/components-app-web-pictogram-web)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# Pictogram
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|variant| String | yes | brand, business | brand | Design variant |
|
|
13
|
+
|iconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icon-web--all |
|
|
14
|
+
|size| String | yes | small, large | small | |
|
|
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/pictogram/pictogram.njk' import Pictogram %}
|
|
27
|
+
|
|
28
|
+
{{ Pictogram({
|
|
29
|
+
variant: "business",
|
|
30
|
+
size: "small",
|
|
31
|
+
iconName: "lock",
|
|
32
|
+
attributes: { "aria-label": "Låst innehåll"}
|
|
33
|
+
})}}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### SCSS
|
|
37
|
+
```scss
|
|
38
|
+
@use "@bonniernews/dn-design-system-web/components/pictogram/pictogram";
|
|
39
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
3
|
+
|
|
4
|
+
{% macro Pictogram(params) %}
|
|
5
|
+
{%- set componentClassName = "ds-pictogram" %}
|
|
6
|
+
{%- set classNamePrefix = componentClassName + "--" %}
|
|
7
|
+
{%- set additionalClasses = [] %}
|
|
8
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
|
|
10
|
+
{%- if params.forcePx %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
{%- if params.variant and params.variant != "brand" %}
|
|
15
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
|
|
16
|
+
{% endif %}
|
|
17
|
+
|
|
18
|
+
{%- if params.size and params.size != "small" %}
|
|
19
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.size), additionalClasses) %}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{%- if params.classNames %}
|
|
23
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
24
|
+
{% endif%}
|
|
25
|
+
|
|
26
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
27
|
+
<div class="{{ classes }}" {{- attributes | safe }}>
|
|
28
|
+
{{ IconUse({ icon: params.iconName, attributs: { "aria-hidden": "true" } }) }}
|
|
29
|
+
</div>
|
|
30
|
+
{% endmacro %}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../icon-sprite/icon-sprite.scss";
|
|
3
|
+
|
|
4
|
+
$ds-pictogram__size: 40px;
|
|
5
|
+
$ds-pictogram__size--large: 64px;
|
|
6
|
+
$ds-pictogram__icon-size: 24px;
|
|
7
|
+
$ds-pictogram__icon-size--large: 40px;
|
|
8
|
+
|
|
9
|
+
.ds-pictogram {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
background-color: $ds-color-static-red-200;
|
|
15
|
+
height: ds-px-to-rem($ds-pictogram__size);
|
|
16
|
+
width: ds-px-to-rem($ds-pictogram__size);
|
|
17
|
+
@at-root .ds-force-px#{&} {
|
|
18
|
+
height: $ds-pictogram__size;
|
|
19
|
+
width: $ds-pictogram__size;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-icon {
|
|
23
|
+
fill: $ds-color-static-black;
|
|
24
|
+
display: flex;
|
|
25
|
+
height: ds-px-to-rem($ds-pictogram__icon-size);
|
|
26
|
+
width: ds-px-to-rem($ds-pictogram__icon-size);
|
|
27
|
+
@at-root .ds-force-px#{&} {
|
|
28
|
+
height: $ds-pictogram__icon-size;
|
|
29
|
+
width: $ds-pictogram__icon-size;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.ds-pictogram--business {
|
|
34
|
+
background-color: $ds-color-static-green-100;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.ds-pictogram--large {
|
|
38
|
+
height: ds-px-to-rem($ds-pictogram__size--large);
|
|
39
|
+
width: ds-px-to-rem($ds-pictogram__size--large);
|
|
40
|
+
@at-root .ds-force-px#{&} {
|
|
41
|
+
height: $ds-pictogram__size--large;
|
|
42
|
+
width: $ds-pictogram__size--large;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-icon {
|
|
46
|
+
height: ds-px-to-rem($ds-pictogram__icon-size--large);
|
|
47
|
+
width: ds-px-to-rem($ds-pictogram__icon-size--large);
|
|
48
|
+
@at-root .ds-force-px#{&} {
|
|
49
|
+
height: $ds-pictogram__icon-size--large;
|
|
50
|
+
width: $ds-pictogram__icon-size--large;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|parameter | type | required | options | default | description |
|
|
11
11
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
12
|
|bodyHtml | HTML String | yes | | | |
|
|
13
|
-
|
|
|
13
|
+
|theme | String | no | default, kultur, nyheter, sport, ekonomi | | Design theme |
|
|
14
14
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
15
15
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
16
16
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
|
|
@@ -25,7 +25,6 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
25
25
|
{% from '@bonniernews/dn-design-system-web/components/quote/quote.njk' import Quote %}
|
|
26
26
|
|
|
27
27
|
{{ Quote({
|
|
28
|
-
variant: "culture",
|
|
29
28
|
bodyHtml: ""
|
|
30
29
|
})}}
|
|
31
30
|
```
|
|
@@ -3,24 +3,22 @@
|
|
|
3
3
|
{% macro Quote(params) %}
|
|
4
4
|
{% set componentClassName = "ds-quote" %}
|
|
5
5
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
-
{% set
|
|
6
|
+
{% set additionalClasses = [] %}
|
|
7
7
|
{% set attributes = getAttributes(params.attributes) %}
|
|
8
8
|
|
|
9
9
|
{% if params.forcePx %}
|
|
10
|
-
{% set
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
11
11
|
{% endif %}
|
|
12
12
|
|
|
13
|
-
{% if params.
|
|
14
|
-
{% set
|
|
15
|
-
{% else %}
|
|
16
|
-
{% set variant = (variant.push(classNamePrefix + "standard"), variant) %}
|
|
13
|
+
{% if params.theme %}
|
|
14
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
17
15
|
{% endif %}
|
|
18
16
|
|
|
19
17
|
{% if params.classNames %}
|
|
20
|
-
{% set
|
|
18
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
21
19
|
{% endif%}
|
|
22
20
|
|
|
23
|
-
{% set classes = componentClassName + " " +
|
|
21
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
24
22
|
|
|
25
23
|
<blockquote class="{{ classes }}" {{- attributes | safe }}>
|
|
26
24
|
<span class="{{ componentClassName + '__border'}}"></span>
|
|
@@ -17,21 +17,8 @@
|
|
|
17
17
|
display: block;
|
|
18
18
|
width: 40px;
|
|
19
19
|
height: 8px;
|
|
20
|
-
color: $ds-color
|
|
20
|
+
color: $ds-theme-color;
|
|
21
21
|
background: currentColor;
|
|
22
22
|
margin: ds-spacing-component(0 0 $ds-sc-x2);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
&--culture .ds-quote__border {
|
|
26
|
-
color: $ds-color-static-kultur;
|
|
27
|
-
}
|
|
28
|
-
&--sport .ds-quote__border {
|
|
29
|
-
color: $ds-color-static-sport;
|
|
30
|
-
}
|
|
31
|
-
&--economy .ds-quote__border {
|
|
32
|
-
color: $ds-color-static-economy;
|
|
33
|
-
}
|
|
34
|
-
&--sthlm .ds-quote__border {
|
|
35
|
-
color: $ds-color-static-sthlm;
|
|
36
|
-
}
|
|
37
24
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{% from '@bonniernews/dn-design-system-web/
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/assets/form-field/form-field.njk' import FormField %}
|
|
3
3
|
|
|
4
4
|
{# Internal helper macro - not intended for use outside of this file #}
|
|
5
5
|
{% macro RadioButtonIcons(componentClassName) %}
|
|
6
6
|
<span class="{{ componentClassName + '__icon'}}">
|
|
7
|
-
{{
|
|
8
|
-
{{
|
|
7
|
+
{{ IconUse({ icon: "radio_button_unchecked" }) }}
|
|
8
|
+
{{ IconUse({ icon: "radio_button_checked" }) }}
|
|
9
9
|
</span>
|
|
10
10
|
{% endmacro %}
|
|
11
11
|
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "
|
|
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/icons/icon.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../icon-sprite/icon-sprite.scss";
|
|
8
3
|
@use "../../assets/form-field/form-field.scss" as *;
|
|
9
4
|
|
|
10
5
|
$ds-radio-btn__icon-size: 24px;
|
|
@@ -65,9 +60,12 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
&:
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
&:active::before {
|
|
64
|
+
background-color: $ds-color-component-primary-overlay;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include ds-hover() {
|
|
68
|
+
&:hover::before {
|
|
71
69
|
background-color: $ds-color-component-primary-overlay;
|
|
72
70
|
}
|
|
73
71
|
}
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
{%
|
|
2
|
-
{% set componentClassName = "ds-spinner" %}
|
|
3
|
-
{% set classNamePrefix = componentClassName + "--" %}
|
|
4
|
-
{% set variant = [] %}
|
|
5
|
-
{% set size = params.size | default("large") %}
|
|
6
|
-
{% set attributes %}
|
|
7
|
-
{% for attribute, value in params.attributes %}
|
|
8
|
-
{{attribute}}="{{value}}"
|
|
9
|
-
{% endfor %}
|
|
10
|
-
{% endset %}
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
11
2
|
|
|
12
|
-
|
|
3
|
+
{% macro Spinner(params) %}
|
|
4
|
+
{%- set componentClassName = "ds-spinner" %}
|
|
5
|
+
{%- set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{%- set additionalClasses = [] %}
|
|
7
|
+
{%- set size = params.size | default("large") %}
|
|
8
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
{%- set additionalClasses = (additionalClasses.push(classNamePrefix + size), additionalClasses) %}
|
|
13
10
|
|
|
14
|
-
{
|
|
15
|
-
{% set
|
|
11
|
+
{%- if params.forcePx %}
|
|
12
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
16
13
|
{% endif %}
|
|
17
14
|
|
|
18
|
-
{
|
|
19
|
-
{% set
|
|
15
|
+
{%- if params.classNames %}
|
|
16
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
20
17
|
{% endif%}
|
|
21
18
|
|
|
22
|
-
{
|
|
23
|
-
{% set
|
|
19
|
+
{%- if params.variant %}
|
|
20
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
|
|
24
21
|
{% else %}
|
|
25
|
-
{% set
|
|
22
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + "primary"), additionalClasses) %}
|
|
26
23
|
{% endif %}
|
|
27
24
|
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
25
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
26
|
+
<span class="{{ classes }}" {{- attributes | safe }}>
|
|
27
|
+
<span class="{{ componentClassName + '__inner'}}"></span>
|
|
28
|
+
</span>
|
|
33
29
|
{% endmacro %}
|
|
@@ -12,18 +12,21 @@ $ds-spinner__shadow-border-opacity: 0.2;
|
|
|
12
12
|
|
|
13
13
|
.ds-spinner {
|
|
14
14
|
.ds-spinner__inner {
|
|
15
|
+
display: block;
|
|
15
16
|
border-radius: $ds-spinner__border-radius;
|
|
16
17
|
animation: ds-spinner-animation 1s linear infinite;
|
|
17
18
|
border-style: solid;
|
|
18
19
|
border-color: transparent;
|
|
19
20
|
position: relative;
|
|
21
|
+
box-sizing: border-box;
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
&::before {
|
|
22
24
|
content: "";
|
|
23
25
|
position: absolute;
|
|
24
26
|
opacity: $ds-spinner__shadow-border-opacity;
|
|
25
27
|
border-radius: $ds-spinner__border-radius;
|
|
26
28
|
border-style: solid;
|
|
29
|
+
box-sizing: border-box;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-dot](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-dot)
|
|
2
|
+
- Storybook: [TeaserDot > Web](https://designsystem.dn.se/?path=/story/components-app-web-teaser-dot-web)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# TeaserDot
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|flashing | boolean | no | true, false | false | If the dot should be flashing |
|
|
13
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
14
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|
|
17
|
+
## Minimum requirement example
|
|
18
|
+
|
|
19
|
+
### Nunjucks
|
|
20
|
+
|
|
21
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
|
|
25
|
+
|
|
26
|
+
{{ TeaserDot({
|
|
27
|
+
flashing: false
|
|
28
|
+
})}}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### SCSS
|
|
32
|
+
```scss
|
|
33
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot";
|
|
34
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserDot(params) %}
|
|
4
|
+
{% set componentClassName = "ds-teaser-dot" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set variant = [] %}
|
|
7
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{% if params.classNames %}
|
|
10
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
11
|
+
{% endif%}
|
|
12
|
+
|
|
13
|
+
{% if params.forcePx %}
|
|
14
|
+
{% set variant = (variant.push("ds-force-px"), variant) %}
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if params.flashing %}
|
|
18
|
+
{% set variant = (variant.push(classNamePrefix + "flashing"), variant) %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
22
|
+
|
|
23
|
+
<span class="{{ classes }}" {{ attributes | safe }}></span>
|
|
24
|
+
{% endmacro %}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
$ds-teaser-dot-size: 10px;
|
|
4
|
+
|
|
5
|
+
.ds-teaser-dot {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
background-color: $ds-theme-color;
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
height: ds-px-to-rem($ds-teaser-dot-size);
|
|
11
|
+
width: ds-px-to-rem($ds-teaser-dot-size);
|
|
12
|
+
margin-right: ds-px-to-rem(1px);
|
|
13
|
+
|
|
14
|
+
@at-root .ds-force-px#{&} {
|
|
15
|
+
height: $ds-teaser-dot-size;
|
|
16
|
+
width: $ds-teaser-dot-size;
|
|
17
|
+
margin-right: 1px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
21
|
+
&.ds-teaser-dot--flashing {
|
|
22
|
+
animation: pulse 1.25s ease-in-out infinite;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes pulse {
|
|
28
|
+
0% {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
50% {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
100% {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-image)
|
|
2
|
+
- Storybook (PROD): [TeaserImage > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserimage-web--teaser-image)
|
|
3
|
+
- Storybook (LATEST): [TeaserImage > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserimage-web--teaser-image)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-image
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|imageHtml | HTML String | yes | | | The img element or equivalent |
|
|
14
|
+
|byline | String | no | | | Media credit text |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|~forcePx~ | | | | | Always applied |
|
|
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/teaser-image/teaser-image.njk' import TeaserImage %}
|
|
27
|
+
|
|
28
|
+
{{ TeaserImage({
|
|
29
|
+
imageHtml: "<img src='??'>",
|
|
30
|
+
byline: "Foto: Paul Hansen"
|
|
31
|
+
})}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### SCSS
|
|
35
|
+
```scss
|
|
36
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-image/teaser-image" as *;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This scss is already included in `teaser.scss`.
|
|
40
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserImage(params) %}
|
|
4
|
+
{% set macroClassName = "ds-teaser-image" %}
|
|
5
|
+
{% set additionalClasses = [] %}
|
|
6
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
7
|
+
|
|
8
|
+
{% if params.classNames %}
|
|
9
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
10
|
+
{% endif %}
|
|
11
|
+
|
|
12
|
+
{% set classes = macroClassName + " " + additionalClasses | join(" ") %}
|
|
13
|
+
|
|
14
|
+
<figure class="{{ classes }}" {{- attributes | safe }}>
|
|
15
|
+
{{ params.imageHtml | safe }}
|
|
16
|
+
|
|
17
|
+
{% if params.byline %}
|
|
18
|
+
<figcaption class={{ macroClassName + "__byline" }}>{{ params.byline }}</figcaption>
|
|
19
|
+
{% endif %}
|
|
20
|
+
</figure>
|
|
21
|
+
{% endmacro %}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-teaser-image {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin: 0;
|
|
7
|
+
|
|
8
|
+
.ds-teaser-image__byline {
|
|
9
|
+
position: absolute;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
padding: ds-spacing-component($ds-sc-x1 $ds-sc-x2);
|
|
13
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
14
|
+
|
|
15
|
+
@include ds-typography($ds-typography-functional-meta01regular, true);
|
|
16
|
+
color: $ds-color-static-white;
|
|
17
|
+
|
|
18
|
+
background-color: $ds-color-static-transparent-black;
|
|
19
|
+
z-index: 5;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-large](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-large)
|
|
2
|
+
- Storybook (PROD): [TeaserLarge > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserlarge-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserLarge > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserlarge-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-large
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | String | yes | | | Heading of the teaser |
|
|
14
|
+
|targetLink | String | yes | | | Target URL for the teaser |
|
|
15
|
+
|variant | String | no | "default" or "podd" | "default" | |
|
|
16
|
+
|areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
17
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
18
|
+
|text | String | no | | | Teaser subtext |
|
|
19
|
+
|vignette | String | no | | | Top text in the teaser |
|
|
20
|
+
|highlight | String | no | | | Text before the heading |
|
|
21
|
+
|sticker | String | no | | | Red text before the text |
|
|
22
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
23
|
+
|bylineHtml | HTML String | no | | | Side image of the author |
|
|
24
|
+
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
25
|
+
|isLargeHeadline | bool | no | true, false | false | If the headline should be large. Only has an effect if `isItalicHeadline` is true. |
|
|
26
|
+
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
27
|
+
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
28
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
29
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
30
|
+
|~forcePx~ | | | | | Not supported |
|
|
31
|
+
|
|
32
|
+
## Minimum requirement example
|
|
33
|
+
|
|
34
|
+
### Nunjucks
|
|
35
|
+
|
|
36
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-large/teaser-large.njk' import TeaserLarge %}
|
|
40
|
+
|
|
41
|
+
{{ TeaserLarge({
|
|
42
|
+
title: "Upp på börsen",
|
|
43
|
+
text: "Det ser ganska normalt ut på Stockholmsbörsen.",
|
|
44
|
+
highlight: "Ekonominytt:"
|
|
45
|
+
})}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### SCSS
|
|
49
|
+
```scss
|
|
50
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-large/teaser-large" as *;
|
|
51
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
|
|
3
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
|
|
4
|
+
|
|
5
|
+
{% macro TeaserLarge(params) %}
|
|
6
|
+
{% set componentClassName = "ds-teaser" %}
|
|
7
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
+
{% set additionalClasses = ["ds-teaser--large"] %}
|
|
9
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
10
|
+
|
|
11
|
+
{% if params.variant %}
|
|
12
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if params.theme %}
|
|
16
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{% if params.areaType %}
|
|
20
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
|
|
21
|
+
{% endif %}
|
|
22
|
+
|
|
23
|
+
{% if params.isLocked and not params.mediaHtml and not params.bylineHtml and params.isItalicHeadline %}
|
|
24
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + "quote-badge"), additionalClasses) %}
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{% if params.mediaHtml %}
|
|
28
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + 'top-img'), additionalClasses) %}
|
|
29
|
+
{% endif %}
|
|
30
|
+
|
|
31
|
+
{% if params.classNames %}
|
|
32
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
33
|
+
{% endif%}
|
|
34
|
+
|
|
35
|
+
{% if params.isItalicHeadline and params.isLargeHeadline and params.areaType !== "right" %}
|
|
36
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-big-italic"), additionalClasses) %}
|
|
37
|
+
{% elif params.isItalicHeadline %}
|
|
38
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-italic"), additionalClasses) %}
|
|
39
|
+
{% endif %}
|
|
40
|
+
|
|
41
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
42
|
+
|
|
43
|
+
<a href="{{ params.targetLink }}"
|
|
44
|
+
class="{{ classes }}"
|
|
45
|
+
{{- attributes | safe }}>
|
|
46
|
+
|
|
47
|
+
{% if params.mediaHtml %}
|
|
48
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
49
|
+
{{ params.mediaHtml }}
|
|
50
|
+
{% if params.isLocked %}
|
|
51
|
+
{{ VipBadge({
|
|
52
|
+
showText: true,
|
|
53
|
+
forcePx: true
|
|
54
|
+
}) }}
|
|
55
|
+
{% endif %}
|
|
56
|
+
</div>
|
|
57
|
+
{% elif params.isItalicHeadline and params.isLocked %}
|
|
58
|
+
{{ VipBadge({
|
|
59
|
+
showText: false,
|
|
60
|
+
forcePx: true
|
|
61
|
+
}) }}
|
|
62
|
+
{% endif %}
|
|
63
|
+
|
|
64
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
65
|
+
{% if params.vignette %}
|
|
66
|
+
<div class="ds-teaser__vignette">{{ params.vignette }}</div>
|
|
67
|
+
{% endif %}
|
|
68
|
+
<h2 class="ds-teaser__title">
|
|
69
|
+
{% if params.highlight %}
|
|
70
|
+
<span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
|
|
71
|
+
{% endif %}
|
|
72
|
+
{{ params.title | safe }}
|
|
73
|
+
</h2>
|
|
74
|
+
|
|
75
|
+
{% if params.text and params.areaType !== "right" %}
|
|
76
|
+
<p class="{{ componentClassName + '__text' }}">
|
|
77
|
+
{{ TeaserDot({ flashing: params.isFlashingDot }) }}
|
|
78
|
+
{% if params.sticker %}
|
|
79
|
+
<span class="ds-teaser__sticker">
|
|
80
|
+
{{ params.sticker }}
|
|
81
|
+
</span>
|
|
82
|
+
{% endif %}
|
|
83
|
+
{{ params.text | safe }}
|
|
84
|
+
</p>
|
|
85
|
+
{% endif %}
|
|
86
|
+
{% if params.bylineHtml %}
|
|
87
|
+
<div class="{{ componentClassName + '__byline'}}">
|
|
88
|
+
{{ params.bylineHtml | safe }}
|
|
89
|
+
</div>
|
|
90
|
+
{% endif %}
|
|
91
|
+
</div>
|
|
92
|
+
</a>
|
|
93
|
+
{% endmacro %}
|