@bonniernews/dn-design-system-web 4.1.2 → 4.2.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 +9 -0
- package/assets/teaser/teaser.scss +3 -1
- package/components/group-header/README.md +13 -6
- package/components/group-header/group-header.njk +48 -17
- package/components/group-header/group-header.scss +18 -6
- package/components/teaser-list-swipe/README.md +44 -0
- package/components/teaser-list-swipe/teaser-list-swipe.njk +54 -0
- package/components/teaser-list-swipe/teaser-list-swipe.scss +37 -0
- package/components/teaser-onsite/teaser-onsite.scss +1 -1
- package/components/teaser-swipe-card/README.md +40 -0
- package/components/teaser-swipe-card/teaser-swipe-card.njk +54 -0
- package/components/teaser-swipe-card/teaser-swipe-card.scss +88 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 4.2.0 (2023-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** implement `TeaserListSwipe` ([#966](https://github.com/BonnierNews/dn-design-system/issues/966)) ([d93e6cb](https://github.com/BonnierNews/dn-design-system/commit/d93e6cb32dd16d30c83ccca194e2250cd7e06b54))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 4.1.2 (2023-09-06)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -11,14 +11,21 @@
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
13
|
|title | string | yes | | | The title text |
|
|
14
|
-
|variant | string | no | icon, link, toggle | icon | The variant to render |
|
|
15
|
-
|href | string | no | | | If given, the title is rendered as a link
|
|
14
|
+
|variant | string | no | icon, link, toggle, arrows | icon | The variant to render |
|
|
15
|
+
|href | string | no | | | If given, the title is rendered as a link |
|
|
16
16
|
|linkText | string | no | | | The link text to render (only for variant `link`) |
|
|
17
|
-
|
|
|
17
|
+
|toggleText | text | no | | | `text` parameter to ToggleButton (only for variant `toggle`) |
|
|
18
|
+
|toggleSelectedText | text | no | | | `selectedText` parameter to ToggleButton (only for variant `toggle`) |
|
|
19
|
+
|toggleSelected | boolean | no | | | `selected` parameter to ToggleButton (only for variant `toggle`) |
|
|
20
|
+
|toggleLoading | boolean | no | | | `loading` parameter to ToggleButton (only for variant `toggle`) |
|
|
21
|
+
|toggleClassNames | text | no | | | `classNames` parameter to ToggleButton (only for variant `toggle`) |
|
|
22
|
+
|toggleAttributes | text | no | | | `attributes` parameter to ToggleButton (only for variant `toggle`) |
|
|
18
23
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
19
24
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
NB: The `arrows` variant is only active in desktop environments. It is equivalent to `icon` in non-desktop environments.
|
|
27
|
+
|
|
28
|
+
Depending on variant, either the `toggle-*` or `linkText` parameters are allowed. In `icon` and `link` mode, the `href` parameter is required to show the ornament.
|
|
22
29
|
|
|
23
30
|
## Minimum requirement example
|
|
24
31
|
|
|
@@ -29,7 +36,7 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
29
36
|
```html
|
|
30
37
|
{% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
|
|
31
38
|
|
|
32
|
-
{{
|
|
39
|
+
{{ GroupHeader({
|
|
33
40
|
title: "Dagens Nyheter",
|
|
34
41
|
href: "https://www.dn.se/"
|
|
35
42
|
}) }}
|
|
@@ -41,4 +48,4 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
41
48
|
```
|
|
42
49
|
|
|
43
50
|
### JS
|
|
44
|
-
If you
|
|
51
|
+
If you use the `toggle` variant, you might need to initiate that component, [as per the documentation](https://designsystem.dn.se/?path=/readmetab/basic-buttons-buttontoggle--docs).
|
|
@@ -1,42 +1,73 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
3
3
|
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
4
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
5
|
|
|
5
6
|
{% macro GroupHeader(params) %}
|
|
6
7
|
{% set componentClassName = "ds-group-header" %}
|
|
7
8
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
-
{% set
|
|
9
|
+
{% set additionalClasses = [classNamePrefix + (params.variant or 'icon')] %}
|
|
9
10
|
{% set attributes = getAttributes(params.attributes) %}
|
|
10
11
|
|
|
11
12
|
{% if params.classNames %}
|
|
12
|
-
{% set
|
|
13
|
-
{% endif%}
|
|
13
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
14
|
+
{% endif %}
|
|
14
15
|
|
|
15
|
-
{% set classes = componentClassName + " " +
|
|
16
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
16
17
|
|
|
17
18
|
{% set groupHeaderInner %}
|
|
18
19
|
<h2 class="{{ componentClassName + '__title'}}">{{ params.title}}</h2>
|
|
19
20
|
|
|
20
|
-
{% if params.variant == '
|
|
21
|
-
{# Could we add defaults here? #}
|
|
22
|
-
{{ ButtonToggle(params.toggle) }}
|
|
23
|
-
{% elif params.variant == 'link' and params.linkText and params.href %}
|
|
21
|
+
{% if params.variant == 'link' and params.linkText and params.href %}
|
|
24
22
|
<span class="{{ componentClassName + '__right-link' }}">
|
|
25
23
|
{{ params.linkText }}
|
|
26
24
|
</span>
|
|
27
25
|
{% elif (params.variant == 'icon' or not params.variant) and params.href %}
|
|
28
|
-
{{ IconUse({ icon: "arrow_forward" }) }}
|
|
26
|
+
{{ IconUse({ icon: "arrow_forward", classNames: componentClassName + '__icon' }) }}
|
|
27
|
+
{% elif (params.variant == 'arrows') and params.href %}
|
|
28
|
+
{{ IconUse({ icon: "arrow_forward", classNames: componentClassName + '__icon hidden-desktop' }) }}
|
|
29
29
|
{% endif %}
|
|
30
30
|
{% endset %}
|
|
31
31
|
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
{{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
<div class="{{ classes }}" {{ attributes | safe }}>
|
|
33
|
+
{% if params.href %}
|
|
34
|
+
<a class="{{ componentClassName + '__href'}}" href="{{ params.titleHref }}">
|
|
35
|
+
{{ groupHeaderInner | safe }}
|
|
36
|
+
</a>
|
|
37
|
+
{% else %}
|
|
38
38
|
{{ groupHeaderInner | safe }}
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
{% endif %}
|
|
40
|
+
{% if params.variant == 'toggle' %}
|
|
41
|
+
{{ ButtonToggle({
|
|
42
|
+
variant: 'brand',
|
|
43
|
+
size: 'xsmall',
|
|
44
|
+
text: params.toggleText,
|
|
45
|
+
selectedText: params.toggleSelectedText,
|
|
46
|
+
selected: params.toggleSelected,
|
|
47
|
+
loading: params.toggleLoading,
|
|
48
|
+
classNames: params.toggleClassNames,
|
|
49
|
+
attributes: params.toggleAttributes
|
|
50
|
+
}) }}
|
|
51
|
+
{% elif (params.variant == 'arrows') %}
|
|
52
|
+
<div class="{{ componentClassName + '__arrows' }} hidden-mobile hidden-tablet">
|
|
53
|
+
{{ IconButton({
|
|
54
|
+
variant: "elevated",
|
|
55
|
+
size: "small",
|
|
56
|
+
iconName: "arrow_back",
|
|
57
|
+
classNames: "ds-group-header__arrow ds-group-header__arrow--left",
|
|
58
|
+
attributes: {"aria-label": "Föregående"},
|
|
59
|
+
forcePx: true
|
|
60
|
+
}) }}
|
|
61
|
+
{{ IconButton({
|
|
62
|
+
variant: "elevated",
|
|
63
|
+
size: "small",
|
|
64
|
+
iconName: "arrow_forward",
|
|
65
|
+
classNames: "ds-group-header__arrow ds-group-header__arrow--right",
|
|
66
|
+
attributes: {"aria-label": "Nästa"},
|
|
67
|
+
forcePx: true
|
|
68
|
+
}) }}
|
|
69
|
+
</div>
|
|
70
|
+
{% endif %}
|
|
71
|
+
</div>
|
|
41
72
|
|
|
42
73
|
{% endmacro %}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
2
|
@use "../button-toggle/button-toggle.scss";
|
|
3
|
+
@use "../icon-button/icon-button.scss";
|
|
3
4
|
|
|
4
5
|
.ds-group-header {
|
|
5
6
|
display: flex;
|
|
@@ -7,25 +8,35 @@
|
|
|
7
8
|
justify-content: space-between;
|
|
8
9
|
background: $ds-color-background-primary;
|
|
9
10
|
color: $ds-color-text-primary;
|
|
10
|
-
padding: ds-spacing-component(0 $ds-sc-x4);
|
|
11
11
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
12
12
|
|
|
13
13
|
.ds-group-header__right-link,
|
|
14
|
-
.ds-
|
|
15
|
-
.ds-
|
|
14
|
+
.ds-group-header__icon,
|
|
15
|
+
.ds-btn-toggle {
|
|
16
16
|
flex-shrink: 0;
|
|
17
|
+
margin-right: ds-spacing-component($ds-sc-x4);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ds-group-header__arrows {
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
padding-right: ds-spacing-component($ds-sc-x2);
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
.ds-group-header__right-link {
|
|
20
26
|
@include ds-link($ds-link-paragraph);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
.ds-
|
|
29
|
+
.ds-group-header__icon {
|
|
24
30
|
height: 24px;
|
|
25
31
|
width: 24px;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
.ds-group-header__href {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
flex: 1;
|
|
39
|
+
|
|
29
40
|
@include ds-link($ds-link-list);
|
|
30
41
|
|
|
31
42
|
@include ds-hover(true) {
|
|
@@ -42,7 +53,8 @@
|
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
.ds-group-header__title {
|
|
45
|
-
padding: ds-spacing-component($ds-sc-x3
|
|
56
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4);
|
|
57
|
+
flex: 1;
|
|
46
58
|
@include ds-typography($ds-typography-functional-body02bold);
|
|
47
59
|
margin: 0;
|
|
48
60
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-list-swipe](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-list-swipe)
|
|
2
|
+
- Storybook: [TeaserListSwipe](https://designsystem.dn.se/?path=/docs/section-teaserlistswipe--docs)
|
|
3
|
+
- Storybook (Latest): [TeaserListSwipe](https://designsystem-latest.dn.se/?path=/docs/section-teaserlistswipe--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-list-swipe
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | String | yes | | | Heading of the teaser |
|
|
14
|
+
|titleHref | String | no | | | Target URL for the header |
|
|
15
|
+
|areaType | String | no | "main", "right", "bauta", "bautaxl" | | The area where the column is rendered |
|
|
16
|
+
|scrollType | String | no | "arrows", "header" | "arrows" | Where to render the scroll arrows |
|
|
17
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
18
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
19
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
20
|
+
|~forcePx~ | | | | | Not supported |
|
|
21
|
+
|
|
22
|
+
## Minimum requirement example
|
|
23
|
+
|
|
24
|
+
### Nunjucks
|
|
25
|
+
|
|
26
|
+
These are copy paste friendly examples to quickly get started using a component.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-list-swipe/teaser-list-swipe.njk' import TeaserListSwipe %}
|
|
30
|
+
|
|
31
|
+
{% call TeaserListSwipe({
|
|
32
|
+
title: 'DN Direkt',
|
|
33
|
+
targetLink: '/direkt/'
|
|
34
|
+
}) %}
|
|
35
|
+
{% for teaser in teasers}
|
|
36
|
+
(render teasers)
|
|
37
|
+
{% endfor %}
|
|
38
|
+
{% endcall}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### SCSS
|
|
42
|
+
```scss
|
|
43
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-list-swipe/teaser-list-swipe";
|
|
44
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
3
|
+
{% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
|
|
4
|
+
|
|
5
|
+
{% macro TeaserListSwipe(params) %}
|
|
6
|
+
{% set componentClassName = "ds-teaser" %}
|
|
7
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
+
{% set additionalClasses = ["ds-teaser--list-swipe"] %}
|
|
9
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
10
|
+
|
|
11
|
+
{% if params.theme %}
|
|
12
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if params.areaType %}
|
|
16
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{% if params.classNames %}
|
|
20
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
21
|
+
{% endif %}
|
|
22
|
+
|
|
23
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
24
|
+
|
|
25
|
+
<div class="{{ classes }}" {{- attributes | safe }}>
|
|
26
|
+
{{ GroupHeader({
|
|
27
|
+
title: params.title,
|
|
28
|
+
href: params.titleHref,
|
|
29
|
+
variant: 'arrows' if params.scrollType == 'header'
|
|
30
|
+
}) }}
|
|
31
|
+
<div class="{{ componentClassName + '__carousel'}}">
|
|
32
|
+
{{ caller() }}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{% if params.scrollType != 'header' %}
|
|
36
|
+
{{ IconButton({
|
|
37
|
+
iconName: 'arrow_back',
|
|
38
|
+
variant: 'elevated',
|
|
39
|
+
size: 'small',
|
|
40
|
+
attributes: { 'aria-label': 'Föregående' },
|
|
41
|
+
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--back hidden-mobile hidden-tablet',
|
|
42
|
+
forcePx: true
|
|
43
|
+
}) }}
|
|
44
|
+
{{ IconButton({
|
|
45
|
+
iconName: 'arrow_forward',
|
|
46
|
+
variant: 'elevated',
|
|
47
|
+
size: 'small',
|
|
48
|
+
attributes: { 'aria-label': 'Nästa' },
|
|
49
|
+
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--forward hidden-mobile hidden-tablet',
|
|
50
|
+
forcePx: true
|
|
51
|
+
}) }}
|
|
52
|
+
{% endif %}
|
|
53
|
+
</div>
|
|
54
|
+
{% endmacro %}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
@use "../../components/icon-button/icon-button";
|
|
4
|
+
@use "../../components/group-header/group-header";
|
|
5
|
+
@use "../../components/teaser-swipe-card/teaser-swipe-card";
|
|
6
|
+
|
|
7
|
+
.ds-teaser.ds-teaser--list-swipe {
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
color: $ds-color-text-primary;
|
|
10
|
+
|
|
11
|
+
.ds-teaser__carousel {
|
|
12
|
+
padding: ds-spacing-component(0 $ds-sc-x4);
|
|
13
|
+
padding-bottom: ds-spacing-component($ds-sc-x3);
|
|
14
|
+
overflow-x: scroll;
|
|
15
|
+
display: grid;
|
|
16
|
+
grid-auto-columns: max-content;
|
|
17
|
+
grid-auto-flow: column;
|
|
18
|
+
gap: ds-spacing-component($ds-sc-x2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include ds-mq-only-breakpoint(desktop) {
|
|
22
|
+
.ds-teaser__swipe-arrow {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 50%;
|
|
25
|
+
transform: translateY(-50%);
|
|
26
|
+
z-index: 10;
|
|
27
|
+
|
|
28
|
+
&--back {
|
|
29
|
+
left: ds-spacing-component($ds-sc-x4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--forward {
|
|
33
|
+
right: ds-spacing-component($ds-sc-x4);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-swipe-card](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-swipe-card)
|
|
2
|
+
- Storybook: [Subcomponents > TeaserSwipeCard](https://designsystem.dn.se/?path=/docs/section-subcomponents-teaserswipecard--docs)
|
|
3
|
+
- Storybook (Latest): [Subcomponents > TeaserSwipeCard](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-teaserswipecard--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# TeaserSwipeCard
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | text | yes | | | The title of the teaser |
|
|
14
|
+
|href | text | yes | | | The link of the teaser |
|
|
15
|
+
|highlight | text | no | | | The highlight text of the teaser |
|
|
16
|
+
|time | text | no | | | The timestamp text of the teaser |
|
|
17
|
+
|mediaHtml | html | no | | | The media to render |
|
|
18
|
+
|variant | text | no | default, insandare, direkt | default | The variant of the teaser |
|
|
19
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
20
|
+
|~forcePx~ | bool | no | true, false | false | Not supported |
|
|
21
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
22
|
+
|
|
23
|
+
## Minimum requirement example
|
|
24
|
+
|
|
25
|
+
### Nunjucks
|
|
26
|
+
|
|
27
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-swipe-card/teaser-swipe-card.njk' import TeaserSwipeCard %}
|
|
31
|
+
|
|
32
|
+
{{ TeaserSwipeCard({
|
|
33
|
+
title: "Nyheter händer"
|
|
34
|
+
})}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### SCSS
|
|
38
|
+
```scss
|
|
39
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-swipe-card/teaser-swipe-card";
|
|
40
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserSwipeCard(params) %}
|
|
4
|
+
{% set componentClassName = "ds-teaser-swipe-card" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set additionalClasses = ["ds-teaser"] %}
|
|
7
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{% if params.classNames %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
11
|
+
{% endif%}
|
|
12
|
+
|
|
13
|
+
{% if params.forcePx %}
|
|
14
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if params.variant and params.variant !== "default" %}
|
|
18
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% if params.theme %}
|
|
22
|
+
{% set additionalClasses = (additionalClasses.push("ds-theme--" + params.theme), additionalClasses) %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
26
|
+
|
|
27
|
+
<a href="{{ teaser.href }}" class="{{classes}}" {{- attributes | safe }}>
|
|
28
|
+
{% if params.variant != 'direkt' and params.mediaHtml %}
|
|
29
|
+
{{ params.mediaHtml | safe }}
|
|
30
|
+
{% endif %}
|
|
31
|
+
|
|
32
|
+
<div class="ds-teaser__text">
|
|
33
|
+
{% if params.variant != 'direkt' and params.vignette %}
|
|
34
|
+
<div class="ds-teaser__vignette">{{params.vignette}}</div>
|
|
35
|
+
{% endif %}
|
|
36
|
+
|
|
37
|
+
{% if params.variant == 'direkt' and params.time %}
|
|
38
|
+
<span class="{{ componentClassName + '__time' }}">{{ params.time }}</span>
|
|
39
|
+
{% endif %}
|
|
40
|
+
<h3 class="ds-teaser__title">
|
|
41
|
+
{% if params.variant != 'direkt' and params.highlight %}
|
|
42
|
+
<span class="ds-teaser__highlight">
|
|
43
|
+
{{ params.highlight}}
|
|
44
|
+
</span>
|
|
45
|
+
{% endif %}
|
|
46
|
+
{{ params.title }}
|
|
47
|
+
</h3>
|
|
48
|
+
|
|
49
|
+
{% if params.variant != 'direkt' and params.time %}
|
|
50
|
+
<span class="{{ componentClassName + '__time' }}">{{ params.time }}</span>
|
|
51
|
+
{% endif %}
|
|
52
|
+
</div>
|
|
53
|
+
</a>
|
|
54
|
+
{% endmacro %}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
@use "../../assets/teaser/teaser.scss";
|
|
4
|
+
@use "../../components/teaser-image/teaser-image.scss";
|
|
5
|
+
|
|
6
|
+
.ds-teaser.ds-teaser-swipe-card {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
width: 268px;
|
|
10
|
+
max-width: 75vw; // ensure low-width devices see atleast part of a second teaser
|
|
11
|
+
color: $ds-color-text-primary;
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
|
|
14
|
+
border: ds-metrics-border-width(x1) solid $ds-color-border-primary;
|
|
15
|
+
border-radius: ds-metrics-border-radius(x2);
|
|
16
|
+
overflow: hidden; // ensure media doesn't overflow the border-radius
|
|
17
|
+
|
|
18
|
+
.ds-teaser__text {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4);
|
|
22
|
+
margin: 0;
|
|
23
|
+
flex: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-teaser-swipe-card__time {
|
|
27
|
+
@include ds-typography($ds-typography-functional-meta02regular);
|
|
28
|
+
color: $ds-color-text-primary-02;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ds-teaser__title {
|
|
32
|
+
@include ds-typography($ds-typography-expressive-heading01bold);
|
|
33
|
+
margin-bottom: ds-spacing-component($ds-sc-x1);
|
|
34
|
+
flex: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@include ds-hover(true) {
|
|
38
|
+
.ds-teaser__title {
|
|
39
|
+
@include ds-underline(2px, 2px);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.ds-teaser-swipe-card--insandare {
|
|
44
|
+
.ds-teaser__title {
|
|
45
|
+
@include ds-typography($ds-typography-expressive-heading01italicsemibold);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.ds-teaser-swipe-card--direkt {
|
|
50
|
+
border: none;
|
|
51
|
+
border-radius: 0;
|
|
52
|
+
|
|
53
|
+
&:not(:last-of-type) {
|
|
54
|
+
margin-right: ds-spacing-component($ds-sc-x2);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ds-teaser__text {
|
|
58
|
+
padding: ds-spacing-component($ds-sc-x1 0 0 0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-teaser-swipe-card__time {
|
|
62
|
+
display: flex;
|
|
63
|
+
@include ds-typography($ds-typography-functional-body01semibold);
|
|
64
|
+
color: $ds-theme-color;
|
|
65
|
+
align-items: center;
|
|
66
|
+
margin-bottom: ds-spacing-component($ds-sc-x1);
|
|
67
|
+
|
|
68
|
+
&::before {
|
|
69
|
+
content: "";
|
|
70
|
+
display: block;
|
|
71
|
+
width: ds-spacing-component($ds-sc-x2);
|
|
72
|
+
height: ds-spacing-component($ds-sc-x2);
|
|
73
|
+
background-color: $ds-theme-color;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
margin-right: ds-spacing-component($ds-sc-x2);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&::after {
|
|
79
|
+
content: "";
|
|
80
|
+
display: block;
|
|
81
|
+
height: 2px;
|
|
82
|
+
flex: 1;
|
|
83
|
+
background-color: $ds-color-border-primary;
|
|
84
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
package/package.json
CHANGED