@bonniernews/dn-design-system-web 15.0.0-beta.0 → 15.0.0
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 +153 -0
- package/components/article-body-image/README-UXD.md +0 -0
- package/components/article-top-image/README-UXD.md +0 -0
- package/components/badge/README-UXD.md +0 -0
- package/components/blocked-content/README-UXD.md +0 -0
- package/components/buddy-menu/README-UXD.md +0 -0
- package/components/button/README-UXD.md +40 -0
- package/components/button/button.njk +32 -33
- package/components/button/button.scss +89 -90
- package/components/button-toggle/README-UXD.md +0 -0
- package/components/byline/README-UXD.md +0 -0
- package/components/checkbox/README-UXD.md +0 -0
- package/components/direkt-circle/README-UXD.md +0 -0
- package/components/disclaimer/README-UXD.md +0 -0
- package/components/divider/README-UXD.md +0 -0
- package/components/factbox/README-UXD.md +0 -0
- package/components/floating-button/README-UXD.md +0 -0
- package/components/footer/README-UXD.md +0 -0
- package/components/game-header/README-UXD.md +0 -0
- package/components/group-header/README-UXD.md +0 -0
- package/components/group-header/README.md +1 -1
- package/components/group-header/group-header.njk +5 -2
- package/components/group-header/group-header.scss +26 -2
- package/components/icon-button/README-UXD.md +0 -0
- package/components/icon-button/icon-button.njk +2 -1
- package/components/icon-button-toggle/README-UXD.md +0 -0
- package/components/icon-button-toggle/README.md +0 -1
- package/components/icon-button-toggle/icon-button-toggle.njk +1 -2
- package/components/icon-sprite/README-UXD.md +0 -0
- package/components/icon-sprite/README.md +1 -0
- package/components/icon-with-wrapper/README-UXD.md +0 -0
- package/components/image-caption/README-UXD.md +0 -0
- package/components/link-box/README-UXD.md +0 -0
- package/components/list-item/README-UXD.md +0 -0
- package/components/list-item/README-accordion.md +1 -1
- package/components/list-item/README-checkbox.md +1 -1
- package/components/list-item/README-image.md +48 -0
- package/components/list-item/README-radio.md +1 -1
- package/components/list-item/README-switch.md +1 -1
- package/components/list-item/README-toggle.md +1 -1
- package/components/list-item/README.md +1 -1
- package/components/list-item/list-item.njk +5 -2
- package/components/list-item/list-item.scss +35 -0
- package/components/modal/README-UXD.md +0 -0
- package/components/pictogram/README-UXD.md +0 -0
- package/components/pictogram/pictogram.scss +1 -1
- package/components/quote/README-UXD.md +0 -0
- package/components/radio-button/README-UXD.md +0 -0
- package/components/spinner/README-UXD.md +0 -0
- package/components/switch/README-UXD.md +0 -0
- package/components/tag-header/README-UXD.md +0 -0
- package/components/tag-header/tag-header.scss +4 -4
- package/components/teaser-card/README-UXD.md +0 -0
- package/components/teaser-dot/README-UXD.md +0 -0
- package/components/teaser-footer/README-UXD.md +0 -0
- package/components/teaser-footer/teaser-footer.scss +2 -2
- package/components/teaser-image/README-UXD.md +0 -0
- package/components/teaser-large/README-UXD.md +0 -0
- package/components/teaser-large/teaser-large.scss +3 -3
- package/components/teaser-list-swipe/README-UXD.md +0 -0
- package/components/teaser-list-swipe/teaser-list-swipe.njk +2 -2
- package/components/teaser-list-vertical/README-UXD.md +0 -0
- package/components/teaser-longlife/README-UXD.md +0 -0
- package/components/teaser-native/README-UXD.md +0 -0
- package/components/teaser-onsite/README-UXD.md +0 -0
- package/components/teaser-package/README-UXD.md +0 -0
- package/components/teaser-package/README.md +1 -0
- package/components/teaser-package/teaser-package.njk +9 -1
- package/components/teaser-right-now/README-UXD.md +0 -0
- package/components/teaser-slideshow/README-UXD.md +0 -0
- package/components/teaser-split/README-UXD.md +0 -0
- package/components/teaser-split/teaser-split.scss +1 -1
- package/components/teaser-standard/README-UXD.md +0 -0
- package/components/teaser-standard/teaser-standard.scss +2 -2
- package/components/teaser-swipe-card/README-UXD.md +0 -0
- package/components/teaser-tipsa/README-UXD.md +0 -0
- package/components/text-button/README-UXD.md +0 -0
- package/components/text-button-toggle/README-UXD.md +0 -0
- package/components/text-input/README-UXD.md +0 -0
- package/components/thematic-break/README-UXD.md +0 -0
- package/components/tooltip/README-UXD.md +0 -0
- package/components/tooltip/README.md +51 -0
- package/components/tooltip/tooltip.js +59 -0
- package/components/tooltip/tooltip.njk +38 -0
- package/components/tooltip/tooltip.scss +63 -0
- package/components/video-caption/README-UXD.md +0 -0
- package/components/vip-badge/README-UXD.md +0 -0
- package/foundations/helpers/README-UXD.md +0 -0
- package/foundations/typography/README-UXD.md +0 -0
- package/foundations/variables/colorsCssVariables.scss +2 -1
- package/foundations/variables/colorsDnDarkTokens.scss +2 -1
- package/foundations/variables/colorsDnLightTokens.scss +2 -1
- package/foundations/variables/typographyTokensScreenExtraLarge.scss +3 -3
- package/foundations/variables/typographyTokensScreenLarge.scss +3 -3
- package/foundations/variables/typographyTokensScreenSmall.scss +2 -2
- package/introduction/README-UXD.md +1 -0
- package/introduction/README.md +19 -0
- package/package.json +1 -1
- package/tokens/colors-css-variables.json +2 -1
- package/tokens/colors-dark-mode.json +3 -2
- package/tokens/colors-light-mode.json +3 -2
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
@use "../button-toggle/button-toggle.scss";
|
|
3
3
|
@use "../icon-button/icon-button.scss";
|
|
4
4
|
|
|
5
|
+
$ds-group-header__icon-size: 24px;
|
|
6
|
+
|
|
5
7
|
.ds-group-header {
|
|
6
8
|
--group-header-background: #{$ds-color-background-primary};
|
|
7
9
|
--group-header-color: #{$ds-color-text-primary};
|
|
@@ -40,6 +42,11 @@
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
&--image {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
.ds-group-header__right-link,
|
|
44
51
|
.ds-group-header__icon,
|
|
45
52
|
.ds-btn--toggle {
|
|
@@ -69,8 +76,8 @@
|
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
.ds-group-header__icon {
|
|
72
|
-
height: ds-px-to-rem(
|
|
73
|
-
width: ds-px-to-rem(
|
|
79
|
+
height: ds-px-to-rem($ds-group-header__icon-size);
|
|
80
|
+
width: ds-px-to-rem($ds-group-header__icon-size);
|
|
74
81
|
color: var(--group-header-icon-color);
|
|
75
82
|
}
|
|
76
83
|
|
|
@@ -112,4 +119,21 @@
|
|
|
112
119
|
&--bautaxl .ds-group-header__title {
|
|
113
120
|
@include ds-typography($ds-typography-detailbaota-xl-label);
|
|
114
121
|
}
|
|
122
|
+
|
|
123
|
+
.ds-group-header__image {
|
|
124
|
+
margin-left: ds-spacing($ds-s-100);
|
|
125
|
+
|
|
126
|
+
.picture,
|
|
127
|
+
img {
|
|
128
|
+
max-height: ds-px-to-rem($ds-group-header__icon-size);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
figure {
|
|
132
|
+
margin: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
+ .ds-group-header__title {
|
|
136
|
+
padding-left: ds-spacing($ds-s-075);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
115
139
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|emphasis | String | no | default, elevated, outline, transparent | default | |
|
|
19
19
|
|size| String | no | small, medium, large | medium | |
|
|
20
20
|
|loading | bool | no | true, false | false | |
|
|
21
|
-
|a11y.visuallyHidden | Object | no | | | Ex. a11y: { visuallyHidden: "Dela på TikTok" } |
|
|
22
21
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
23
22
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
24
23
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain item types |
|
|
14
14
|
|accordionContent | String | yes | | | It is possible to use html |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | Also used as id |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/list-item](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/list-item)
|
|
2
|
+
- Storybook: [ListItem > ImageListItem](https://designsystem.dn.se/?path=/docs/basic-listitem-imagelistitem--docs)
|
|
3
|
+
- Storybook (Latest): [ListItem > ImageListItem](https://designsystem-latest.dn.se/?path=/docs/basic-listitem-imagelistitem--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# Image List Item
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|listItemType | String | no | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
|
+
|title | String | no | | | |
|
|
15
|
+
|subtitle | String | no | | | |
|
|
16
|
+
|meta | String | no | | | |
|
|
17
|
+
|disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
|
|
18
|
+
|border | bool | no | true, false | false | |
|
|
19
|
+
|mediaHtml | String | no | | | Main image |
|
|
20
|
+
|trailingIcon | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
21
|
+
|href | String | no | | | If href is set the list item will be rendered as an a-tag |
|
|
22
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
23
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
24
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
25
|
+
|
|
26
|
+
## Minimum requirement example
|
|
27
|
+
|
|
28
|
+
### Nunjucks
|
|
29
|
+
|
|
30
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
{% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import ListItem %}
|
|
34
|
+
|
|
35
|
+
{{ ListItem({
|
|
36
|
+
listItemType: 'image',
|
|
37
|
+
title: 'My list item',
|
|
38
|
+
mediaHtml: 'image-html',
|
|
39
|
+
trailingIcon: 'arrow_forward',
|
|
40
|
+
subtitle: 'Subtitle text',
|
|
41
|
+
meta: 'Meta text'
|
|
42
|
+
})}}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### SCSS
|
|
46
|
+
```scss
|
|
47
|
+
@use "@bonniernews/dn-design-system-web/components/list-item/list-item";
|
|
48
|
+
```
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | |
|
|
15
15
|
|id | String | yes | | | |
|
|
16
16
|
|title | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | Also used as id |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, toggle, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, toggle, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|title | String | yes | | | |
|
|
15
15
|
|titleHref | String | no | | | If titleHref is set the list item title will be rendered as an a-tag |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | no | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | no | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|title | String | no | | | |
|
|
15
15
|
|subtitle | String | no | | | |
|
|
16
16
|
|meta | String | no | | | |
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
{% if iconLeftSvg %}
|
|
15
15
|
<span class="{{ componentClassName + '__icon-left'}}">{{- iconLeftSvg | safe -}}</span>
|
|
16
16
|
{% endif %}
|
|
17
|
+
{% if params.listItemType == 'image' %}
|
|
18
|
+
<div class="{{ componentClassName + '__image'}}">{{ params.mediaHtml }}</div>
|
|
19
|
+
{% endif %}
|
|
17
20
|
{% if params.title %}
|
|
18
21
|
<div class="{{ componentClassName + '__titles'}}">
|
|
19
22
|
{% if params.titleHref and not params.disabled %}
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
47
50
|
{% set attributes = getAttributes(params.attributes) %}
|
|
48
51
|
|
|
49
|
-
{% if params.listItemType == "standard" or not params.listItemType %}
|
|
52
|
+
{% if params.listItemType == "standard" or params.listItemType == "image" or not params.listItemType %}
|
|
50
53
|
{% set element = "link" if params.href and not params.disabled else "button" %}
|
|
51
54
|
{% set variantClass = classNamePrefix + "standard" %}
|
|
52
55
|
{% else %}
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
{% set variantClass = classNamePrefix + params.listItemType %}
|
|
55
58
|
{% endif %}
|
|
56
59
|
|
|
57
|
-
{% if params.leadingIcon %}
|
|
60
|
+
{% if params.leadingIcon and params.listItemType != "image" %}
|
|
58
61
|
{% set iconLeftSvg = IconUse({ icon: params.leadingIcon }) %}
|
|
59
62
|
{% endif %}
|
|
60
63
|
|
|
@@ -110,6 +110,41 @@ $ds-list-item__icon-size: 24px;
|
|
|
110
110
|
margin-left: ds-spacing($ds-s-100);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
.ds-list-item__image {
|
|
114
|
+
.picture,
|
|
115
|
+
img {
|
|
116
|
+
max-height: ds-px-to-rem($ds-list-item__icon-size);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@at-root .ds-force-px#{&} {
|
|
120
|
+
.picture,
|
|
121
|
+
img {
|
|
122
|
+
height: $ds-list-item__icon-size;
|
|
123
|
+
width: $ds-list-item__icon-size;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
figure {
|
|
128
|
+
margin: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
+ .ds-list-item__titles {
|
|
132
|
+
margin-left: ds-spacing($ds-s-100);
|
|
133
|
+
|
|
134
|
+
.ds-list-item__title {
|
|
135
|
+
@include ds-typography($ds-typography-functionalbody02, $fontWeight: $ds-fontweight-semibold);
|
|
136
|
+
|
|
137
|
+
@at-root .ds-force-px#{&} {
|
|
138
|
+
@include ds-typography(
|
|
139
|
+
$ds-typography-functional-body02regular,
|
|
140
|
+
$forcePx: true,
|
|
141
|
+
$fontWeight: $ds-fontweight-semibold
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
113
148
|
@include ds-hover() {
|
|
114
149
|
&:hover:not(.ds-list-item--disabled) .ds-list-item__inner::before {
|
|
115
150
|
background-color: $ds-color-component-primary-overlay;
|
|
File without changes
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ $ds-pictogram__icon-size--large: 40px;
|
|
|
11
11
|
align-items: center;
|
|
12
12
|
justify-content: center;
|
|
13
13
|
border-radius: 50%;
|
|
14
|
-
background-color: $ds-color-static-red-
|
|
14
|
+
background-color: $ds-color-static-red-100;
|
|
15
15
|
height: ds-px-to-rem($ds-pictogram__size);
|
|
16
16
|
width: ds-px-to-rem($ds-pictogram__size);
|
|
17
17
|
@at-root .ds-force-px#{&} {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.ds-tag-header__vignette {
|
|
36
|
-
@include ds-typography($ds-typography-
|
|
36
|
+
@include ds-typography($ds-typography-functionallabel01);
|
|
37
37
|
color: $ds-theme-color;
|
|
38
38
|
margin-bottom: ds-spacing($ds-s-025);
|
|
39
39
|
display: block;
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.ds-tag-header__title {
|
|
47
|
-
@include ds-typography($ds-typography-
|
|
47
|
+
@include ds-typography($ds-typography-functionalheading03, $fontWeight: $ds-fontweight-bold);
|
|
48
48
|
color: $ds-color-text-primary;
|
|
49
49
|
margin: 0;
|
|
50
50
|
word-break: break-word;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
.ds-tag-header__description {
|
|
63
|
-
@include ds-typography($ds-typography-
|
|
63
|
+
@include ds-typography($ds-typography-functionalbody02);
|
|
64
64
|
color: $ds-color-text-primary;
|
|
65
65
|
margin: ds-spacing($ds-s-100 $ds-s-100 0);
|
|
66
66
|
border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
b,
|
|
74
74
|
strong {
|
|
75
|
-
@include ds-typography($ds-typography-
|
|
75
|
+
@include ds-typography($ds-typography-functionalbody02, $fontWeight: $ds-fontweight-semibold);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
p {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.ds-teaser-footer__notes {
|
|
12
|
-
@include ds-typography($ds-typography-
|
|
12
|
+
@include ds-typography($ds-typography-functionalmeta02);
|
|
13
13
|
display: block;
|
|
14
14
|
color: $ds-color-text-primary-02;
|
|
15
15
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
margin-top: ds-spacing($ds-s-050);
|
|
22
22
|
|
|
23
23
|
.ds-teaser-footer__title {
|
|
24
|
-
@include ds-typography($ds-typography-
|
|
24
|
+
@include ds-typography($ds-typography-functionalbody01, $fontWeight: $ds-fontweight-semibold);
|
|
25
25
|
color: $ds-color-text-primary;
|
|
26
26
|
}
|
|
27
27
|
|
|
File without changes
|
|
File without changes
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.ds-teaser__title {
|
|
36
|
-
@include ds-typography($ds-typography-
|
|
36
|
+
@include ds-typography($ds-typography-detailteaser-large);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@include ds-hover(true) {
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
|
|
45
45
|
&.ds-teaser--large-big-italic {
|
|
46
46
|
.ds-teaser__title {
|
|
47
|
-
@include ds-typography($ds-typography-
|
|
47
|
+
@include ds-typography($ds-typography-detailteaser-large-storRubrik-opinion);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&.ds-teaser--large-italic {
|
|
52
52
|
.ds-teaser__title {
|
|
53
|
-
@include ds-typography($ds-typography-
|
|
53
|
+
@include ds-typography($ds-typography-detailteaser-large-opinion);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@include ds-hover(true) {
|
|
File without changes
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
{{ IconButton({
|
|
44
44
|
iconName: 'arrow_back',
|
|
45
45
|
variant: 'primary',
|
|
46
|
-
emphasis: '
|
|
46
|
+
emphasis: 'outline',
|
|
47
47
|
size: 'small',
|
|
48
48
|
attributes: { 'aria-label': 'Föregående' },
|
|
49
49
|
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--back hidden-mobile hidden-tablet',
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
{{ IconButton({
|
|
53
53
|
iconName: 'arrow_forward',
|
|
54
54
|
variant: 'primary',
|
|
55
|
-
emphasis: '
|
|
55
|
+
emphasis: 'outline',
|
|
56
56
|
size: 'small',
|
|
57
57
|
attributes: { 'aria-label': 'Nästa' },
|
|
58
58
|
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--forward hidden-mobile hidden-tablet',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|teasersHtml | HTML String | yes | | | HTML teaser output |
|
|
14
14
|
|vignetteText | String | yes | | | Heading of the teaser |
|
|
15
15
|
|vignetteTargetUrl | String | no | | | Target URL for the teaser |
|
|
16
|
+
|vignetteIconHtml | string | no | | | The icon markup for the vignette |
|
|
16
17
|
|areaType | String | no | "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
17
18
|
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
18
19
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
@@ -11,12 +11,20 @@
|
|
|
11
11
|
params.classNames if params.classNames
|
|
12
12
|
] | join(" ") %}
|
|
13
13
|
{%- set attributes = getAttributes(params.attributes) %}
|
|
14
|
+
|
|
15
|
+
{% if params.vignetteIconHtml %}
|
|
16
|
+
{% set variant = 'image' %}
|
|
17
|
+
{% elif params.areaType === 'bauta' or params.areaType === 'bautaxl'%}
|
|
18
|
+
{% set variant = params.areaType %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
14
21
|
<div class="{{ classes }}">
|
|
15
22
|
{% if params.vignetteText %}
|
|
16
23
|
{{ GroupHeader({
|
|
17
24
|
title: params.vignetteText,
|
|
18
25
|
href: params.vignetteTargetUrl,
|
|
19
|
-
variant:
|
|
26
|
+
variant: variant,
|
|
27
|
+
mediaHtml: params.vignetteIconHtml if params.vignetteIconHtml
|
|
20
28
|
}) }}
|
|
21
29
|
{% endif %}
|
|
22
30
|
{{ params.teasersHtml | safe }}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
|
|
9
9
|
.ds-teaser__title {
|
|
10
|
-
@include ds-typography($ds-typography-
|
|
10
|
+
@include ds-typography($ds-typography-detailteaser-standard);
|
|
11
11
|
|
|
12
12
|
&--italic {
|
|
13
|
-
@include ds-typography($ds-typography-
|
|
13
|
+
@include ds-typography($ds-typography-detailteaser-standard-opinion);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/tooltip](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/tooltip)
|
|
2
|
+
- Storybook: [Tooltip](https://designsystem.dn.se/?path=/docs/basic-tooltip--docs)
|
|
3
|
+
- Storybook (Latest): [Tooltip](https://designsystem-latest.dn.se/?path=/docs/basic-tooltip--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# Tooltip
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
|parameter | type | required | options | default | description |
|
|
13
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
14
|
+
| arrowPosition | String | yes | "top" or "bottom" | | Position of tooltip arrow |
|
|
15
|
+
| title | String | no | | | Title in tooltip |
|
|
16
|
+
| closeButton | bool | no | true, false | false | Render close button if true |
|
|
17
|
+
| closeOnClickOutside | bool | no | true, false | false | Set to true to be able to close tooltip when clicking outside of it |
|
|
18
|
+
| forceOpen | bool | no | true, false | false | Show tooltip on render |
|
|
19
|
+
| classNames | String | no | | | Ex. "my-special-class" |
|
|
20
|
+
| attributes | Object | no | | | Ex. { data-prop: value } |
|
|
21
|
+
| forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
22
|
+
|
|
23
|
+
## Minimum requirement example
|
|
24
|
+
|
|
25
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
26
|
+
|
|
27
|
+
### Nunjucks
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
{% from '@bonniernews/dn-design-system-web/components/tooltip/tooltip.njk' import Tooltip %}
|
|
31
|
+
|
|
32
|
+
{% call Tooltip({closeButton: true, closeOnClickOutside: false, arrowPosition: "top"}) %}
|
|
33
|
+
<h2>Titel</h2>
|
|
34
|
+
<p>Text i vår tooltip</p>
|
|
35
|
+
{% endcall %}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Scss
|
|
39
|
+
|
|
40
|
+
```scss
|
|
41
|
+
@use "@bonniernews/dn-design-system-web/components/tooltip/tooltip";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Javascript
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
import { initTooltip, openTooltip } from '@bonniernews/dn-design-system-web/components/tooltip/tooltip.js'
|
|
48
|
+
const tooltipEl = document.querySelector(".ds-tooltip");
|
|
49
|
+
initTooltip(tooltipEl);
|
|
50
|
+
openTooltip(tooltipEl);
|
|
51
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export {
|
|
2
|
+
initTooltip,
|
|
3
|
+
openTooltip,
|
|
4
|
+
closeTooltip,
|
|
5
|
+
toggleTooltip,
|
|
6
|
+
initTooltipStorybook
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const TOOLTIP_HIDDEN = "ds-tooltip--hidden";
|
|
10
|
+
|
|
11
|
+
let setupTooltipClickListener = true;
|
|
12
|
+
|
|
13
|
+
function initTooltip(tooltipEl) {
|
|
14
|
+
const tooltipsClosingOnOutsideClick = document.getElementsByClassName("ds-tooltip--close-outside-click");
|
|
15
|
+
|
|
16
|
+
if (setupTooltipClickListener && tooltipsClosingOnOutsideClick.length > 0) {
|
|
17
|
+
setupTooltipClickListener = false;
|
|
18
|
+
|
|
19
|
+
document.addEventListener("click", (e) => {
|
|
20
|
+
const tooltipClick = e.target.closest(".ds-tooltip");
|
|
21
|
+
if (tooltipClick) return;
|
|
22
|
+
|
|
23
|
+
const tooltipsToClose = document.getElementsByClassName('ds-tooltip--close-outside-click');
|
|
24
|
+
for (const tooltip of tooltipsToClose) {
|
|
25
|
+
closeTooltip(tooltip)
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const closeButtons = Array.from(tooltipEl.getElementsByClassName("ds-tooltip__close"));
|
|
31
|
+
closeButtons.forEach((button) => {
|
|
32
|
+
button.addEventListener("click", () => {
|
|
33
|
+
closeTooltip(tooltipEl);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function toggleTooltip(tooltipEl, force) {
|
|
39
|
+
tooltipEl.classList.toggle(TOOLTIP_HIDDEN, !force);
|
|
40
|
+
return !tooltipEl.classList.contains(TOOLTIP_HIDDEN);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function openTooltip(tooltipEl) {
|
|
44
|
+
tooltipEl.classList.remove(TOOLTIP_HIDDEN);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function closeTooltip(tooltipEl) {
|
|
49
|
+
tooltipEl.classList.add(TOOLTIP_HIDDEN);
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function initTooltipStorybook() {
|
|
54
|
+
const tooltips = Array.from(document.getElementsByClassName("ds-tooltip"));
|
|
55
|
+
tooltips.forEach((tooltipEl) => {
|
|
56
|
+
initTooltip(tooltipEl);
|
|
57
|
+
openTooltip(tooltipEl);
|
|
58
|
+
});
|
|
59
|
+
}
|