@bonniernews/dn-design-system-web 8.7.0 → 8.8.1

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 CHANGED
@@ -3,6 +3,24 @@
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
+ ## 8.8.1 (2023-11-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **web:** pass group header variant to teaser list swipe ([#1116](https://github.com/BonnierNews/dn-design-system/issues/1116)) ([2f9f49e](https://github.com/BonnierNews/dn-design-system/commit/2f9f49e60c674f5b3cadf27035c10f99cfec976d))
12
+
13
+
14
+
15
+ ## 8.8.0 (2023-11-27)
16
+
17
+
18
+ ### Features
19
+
20
+ * **web:** link box component ([#1115](https://github.com/BonnierNews/dn-design-system/issues/1115)) ([e062369](https://github.com/BonnierNews/dn-design-system/commit/e0623692ab5292d96c83cae29c0b60eb138926f5))
21
+
22
+
23
+
6
24
  ## 8.7.0 (2023-11-24)
7
25
 
8
26
 
@@ -37,7 +37,7 @@
37
37
  </span>
38
38
 
39
39
  {% if params.linkText %}
40
- <span class="{{ componentClassName + '__right-link' }}">
40
+ <span class="{{ componentClassName + '__right-link' }} hidden-desktop">
41
41
  {{ params.linkText }}
42
42
  </span>
43
43
  {% endif %}
@@ -63,7 +63,7 @@
63
63
  classNames: params.toggleClassNames,
64
64
  attributes: params.toggleAttributes
65
65
  }) }}
66
- {% elif (params.variant == 'arrows') %}
66
+ {% elif (params.variant == 'arrows' or params.variant == 'direkt') %}
67
67
  <div class="{{ componentClassName + '__arrows' }} hidden-mobile hidden-tablet">
68
68
  {{ IconButton({
69
69
  variant: "elevated",
@@ -0,0 +1,41 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/link-box](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/link-box)
2
+ - Storybook: [LinkBox](https://designsystem.dn.se/?path=/docs/section-linkbox--docs)
3
+ - Storybook (Latest): [LinkBox](https://designsystem-latest.dn.se/?path=/docs/section-linkbox--docs)
4
+
5
+ ----
6
+
7
+ # link-box
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |linkBoxItems | Array | yes | | | Array with link objects. Ex. [ { label: 'Sverige runt', link: '#', mediaHtml: "", layout: 'quiz', attributes: { "data-test": "list-item-test-data" } } ] |
14
+ |vignetteText | String | no | | | Heading of the link box |
15
+ |vignetteTargetUrl | String | no | | | Target URL for the header |
16
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
17
+ |classNames | String | no | | | Ex. "my-special-class" |
18
+ |~forcePx~ | | | | | Not supported |
19
+
20
+ ## Minimum requirement example
21
+
22
+ ### Nunjucks
23
+
24
+ These are copy paste friendly examples to quickliy get started using a component.
25
+
26
+ ```html
27
+ {% from '@bonniernews/dn-design-system-web/components/link-box/link-box.njk' import LinkBox %}
28
+
29
+ {{ LinkBox({
30
+ vignetteText: "Välj kategori – massor av quiz väntar",
31
+ linkBoxItems: [
32
+ { label: 'Sverige runt', link: '#', mediaHtml: "", layout: 'quiz', attributes: { "data-test": "list-item-test-data" } },
33
+ { label: 'Film & TV', link: '#', mediaHtml: "", layout: 'quiz' }
34
+ ],
35
+ })}}
36
+ ```
37
+
38
+ ### SCSS
39
+ ```scss
40
+ @use "@bonniernews/dn-design-system-web/components/link-box/link-box" as *;
41
+ ```
@@ -0,0 +1,23 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+
3
+ {% macro LinkBoxItem(params) %}
4
+ {% set componentClassName = "ds-link-box-item" %}
5
+ {% set classNamePrefix = componentClassName + "--" %}
6
+ {%- set classes = [
7
+ componentClassName,
8
+ params.classNames if params.classNames,
9
+ classNamePrefix + params.layout if params.layout
10
+ ] | join(" ") %}
11
+ {%- set attributes = getAttributes(params.attributes) %}
12
+ <a class="{{ classes }}" href="{{ params.link }}" {{- attributes | safe }}>
13
+ {% if params.mediaHtml %}
14
+ <div class="{{ componentClassName + '__media'}}">
15
+ {{ params.mediaHtml | safe }}
16
+ </div>
17
+ {% endif %}
18
+
19
+ {% if params.label %}
20
+ <span class="{{ componentClassName + '__label'}}">{{ params.label }}</span>
21
+ {% endif %}
22
+ </a>
23
+ {% endmacro %}
@@ -0,0 +1,51 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+
3
+ .ds-link-box-item {
4
+ padding: ds-spacing($ds-s-100);
5
+ background-color: $ds-color-surface-background;
6
+ border: ds-border-width(x1) solid $ds-color-border-primary;
7
+ border-radius: ds-border-radius(x2);
8
+ text-decoration: none;
9
+ display: flex;
10
+ flex-direction: column;
11
+ align-items: center;
12
+ justify-content: center;
13
+
14
+ &:focus-visible {
15
+ outline: none;
16
+
17
+ .ds-link-box-item__label {
18
+ @include ds-focus(2px, false);
19
+ }
20
+ }
21
+
22
+ @include ds-hover(true) {
23
+ > .ds-link-box-item__label {
24
+ @include ds-underline();
25
+ }
26
+ }
27
+
28
+ .ds-link-box-item__label {
29
+ color: $ds-color-text-primary;
30
+ @include ds-typography($ds-typography-functional-body01semibold);
31
+ text-align: center;
32
+ }
33
+
34
+ .ds-link-box-item__media + .ds-link-box-item__label {
35
+ margin-top: ds-spacing($ds-s-050);
36
+ }
37
+
38
+ .ds-link-box-item__media {
39
+ font-size: 0;
40
+ }
41
+
42
+ // Just sample css, replace with actual when design is available
43
+ &.ds-link-box-item--pod {
44
+ .ds-link-box-item__media {
45
+ &,
46
+ & img {
47
+ width: 100%;
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,26 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
3
+ {% from '@bonniernews/dn-design-system-web/components/link-box/link-box-item.njk' import LinkBoxItem %}
4
+
5
+ {% macro LinkBox(params) %}
6
+ {%- set componentClassName = "ds-link-box" %}
7
+ {%- set classNamePrefix = componentClassName + "--" %}
8
+ {%- set classes = [
9
+ componentClassName,
10
+ params.classNames if params.classNames
11
+ ] | join(" ") %}
12
+ {%- set attributes = getAttributes(params.attributes) %}
13
+ <div class="{{ classes }}" {{- attributes | safe }}>
14
+ {% if params.vignetteText %}
15
+ {{ GroupHeader({
16
+ title: params.vignetteText,
17
+ href: params.vignetteTargetUrl
18
+ }) }}
19
+ {% endif %}
20
+ <div class="{{ componentClassName + '__grid' }}">
21
+ {% for item in params.linkBoxItems %}
22
+ {{ LinkBoxItem(item) | safe }}
23
+ {% endfor %}
24
+ </div>
25
+ </div>
26
+ {% endmacro %}
@@ -0,0 +1,32 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../components/group-header/group-header";
3
+ @use "./link-box-item";
4
+
5
+ $ds-link-box-grid-gap: ds-spacing($ds-s-050);
6
+
7
+ .ds-link-box {
8
+ background-color: $ds-color-surface-background;
9
+
10
+ .ds-link-box__grid {
11
+ padding: ds-spacing($ds-s-075);
12
+ display: grid;
13
+ grid-column-gap: $ds-link-box-grid-gap;
14
+ row-gap: $ds-link-box-grid-gap;
15
+
16
+ @include ds-mq-only-breakpoint(mobile) {
17
+ grid-template-columns: 1fr 1fr;
18
+ }
19
+
20
+ @include ds-mq-only-breakpoint(tablet) {
21
+ grid-template-columns: 1fr 1fr 1fr;
22
+ }
23
+
24
+ @include ds-mq-only-breakpoint(desktop) {
25
+ grid-template-columns: 1fr 1fr 1fr 1fr;
26
+ }
27
+ }
28
+
29
+ .ds-group-header + .ds-link-box__grid {
30
+ padding-top: 0;
31
+ }
32
+ }
@@ -13,6 +13,14 @@
13
13
  params.classNames if params.classNames
14
14
  ] | join(" ") %}
15
15
 
16
+ {% if params.groupHeaderVariant %}
17
+ {% set variant = params.groupHeaderVariant %}
18
+ {% elif arrowPosition === 'header' %}
19
+ {% set variant = 'arrows' %}
20
+ {% else %}
21
+ {% set variant = 'link' %}
22
+ {% endif %}
23
+
16
24
  {%- call TeaserCard({
17
25
  areaType: params.areaType,
18
26
  theme: params.theme,
@@ -22,7 +30,7 @@
22
30
  {{ GroupHeader({
23
31
  title: params.title,
24
32
  href: params.titleHref,
25
- variant: 'arrows' if arrowPosition === 'header' else 'link',
33
+ variant: variant,
26
34
  linkText: 'Visa alla'
27
35
  }) }}
28
36
  <div class="{{ componentClassName + '__carousel'}}">
@@ -21,6 +21,10 @@
21
21
 
22
22
  @include ds-hide-scrollbars();
23
23
  @include ds-teaser-focus(2px);
24
+
25
+ @include ds-mq-only-breakpoint(mobile) {
26
+ margin-right: 0;
27
+ }
24
28
  }
25
29
 
26
30
  @include ds-mq-only-breakpoint(desktop) {
@@ -40,3 +44,7 @@
40
44
  }
41
45
  }
42
46
  }
47
+
48
+ .ds-group-header--direkt + .ds-teaser__carousel .ds-teaser-swipe-card--direkt {
49
+ padding-top: ds-spacing($ds-s-050);
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "8.7.0",
3
+ "version": "8.8.1",
4
4
  "description": "DN design system for web.",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",