@bonniernews/dn-design-system-web 8.6.1 → 8.7.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 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
+ ## 8.7.0 (2023-11-24)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** add Direkt circle as DS component and use it in new group header variant "Direkt" ([#1112](https://github.com/BonnierNews/dn-design-system/issues/1112)) ([a0e6f8b](https://github.com/BonnierNews/dn-design-system/commit/a0e6f8b765b270bf6b0708a034b323809abc6266))
12
+
13
+
14
+
6
15
  ## 8.6.1 (2023-11-23)
7
16
 
8
17
  **Note:** Version bump only for package @bonniernews/dn-design-system-web
@@ -0,0 +1,32 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)
2
+ - Storybook: [Subcomponents > DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
3
+ - Storybook (Latest): [Subcomponents > DirektCircle](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
4
+
5
+ ----
6
+
7
+ # DirektCircle
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |circleColor | String | no | | | Hex code or supported color name |
14
+ |classNames | String | no | | | Ex. "my-special-class" |
15
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
16
+
17
+
18
+ ## Minimum requirement example
19
+
20
+ ### Nunjucks
21
+
22
+ These are copy paste friendly examples to quickliy get started using a component.
23
+
24
+ ```html
25
+ {% from '@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle.njk' import DirektCircle %}
26
+
27
+ {{ DirektCircle() }}
28
+ ```
29
+
30
+ ### SCSS
31
+ ```scss
32
+ @use "@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle";
@@ -0,0 +1,55 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+
3
+ {% macro DirektCircle(params) %}
4
+ {% set componentClassName = "ds-direkt-circle" %}
5
+ {% set classNamePrefix = componentClassName + "--" %}
6
+ {% set attributes = getAttributes(params.attributes) %}
7
+ {% set circleColor = params.circleColor or "white" %}
8
+
9
+ {% set circleOpacity = [
10
+ 0.25,
11
+ 0.25,
12
+ 0.25,
13
+ 0.25,
14
+ 0.25,
15
+ 0.25,
16
+ 0.25,
17
+ 0.25,
18
+ 0.24,
19
+ 0.235,
20
+ 0.222,
21
+ 0.218,
22
+ 0.212,
23
+ 0.202,
24
+ 0.19,
25
+ 0.178,
26
+ 0.165,
27
+ 0.155,
28
+ 0.145,
29
+ 0.135,
30
+ 0.12,
31
+ 0.107,
32
+ 0.095,
33
+ 0.083,
34
+ 0.07,
35
+ 0.06,
36
+ 0.047,
37
+ 0.035,
38
+ 0.023,
39
+ 0.02
40
+ ] %}
41
+
42
+ {%- set classes = [
43
+ componentClassName,
44
+ params.classNames if params.classNames
45
+ ] | join(" ") %}
46
+
47
+ <svg class="{{ classes }}" width="500" height="500" viewBox="-250 -250 500 500" fill="none" xmlns="http://www.w3.org/2000/svg" {{ attributes | safe }}>
48
+ <circle r="5" fill={{circleColor}} />
49
+
50
+ {% for opacity in circleOpacity %}
51
+ {% set radius = loop.index * 8 + 5 %}
52
+ <circle opacity="{{ opacity }}" r="{{ radius }}" stroke={{circleColor}} stroke-width="1.5"/>
53
+ {% endfor %}
54
+ </svg>
55
+ {% endmacro %}
@@ -13,7 +13,7 @@
13
13
  |title | string | yes | | | The title text |
14
14
  |variant | string | no | icon, link, toggle, arrows | icon | The variant to render |
15
15
  |href | string | no | | | If given, the title is rendered as a link |
16
- |linkText | string | no | | | The link text to render (only for variant `link`) |
16
+ |linkText | string | no | | | The link text to render (only for variants `link` and `direkt`) |
17
17
  |showBottomBorder | boolean | no | | | If true there will be a bottom border |
18
18
  |toggleText | text | no | | | `text` parameter to ToggleButton (only for variant `toggle`) |
19
19
  |toggleSelectedText | text | no | | | `selectedText` parameter to ToggleButton (only for variant `toggle`) |
@@ -2,6 +2,7 @@
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
4
  {% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
5
+ {% from '@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle.njk' import DirektCircle %}
5
6
 
6
7
  {% macro GroupHeader(params) %}
7
8
  {% set componentClassName = "ds-group-header" %}
@@ -30,6 +31,16 @@
30
31
  </span>
31
32
  {% elif (params.variant == 'arrows') and params.href %}
32
33
  {{ IconUse({ icon: "arrow_forward", classNames: componentClassName + '__icon hidden-desktop' }) }}
34
+ {% elif params.variant == 'direkt' %}
35
+ <span class="{{ componentClassName + '__direkt-circle' }}">
36
+ {{ DirektCircle()}}
37
+ </span>
38
+
39
+ {% if params.linkText %}
40
+ <span class="{{ componentClassName + '__right-link' }}">
41
+ {{ params.linkText }}
42
+ </span>
43
+ {% endif %}
33
44
  {% endif %}
34
45
  {% endset %}
35
46
 
@@ -28,6 +28,13 @@
28
28
  --group-header-color: #{$ds-color-static-yellow};
29
29
  }
30
30
 
31
+ &--direkt {
32
+ --group-header-background: #{$ds-theme-color};
33
+ --group-header-color: #{$ds-color-text-on-brand};
34
+ position: relative;
35
+ overflow: hidden;
36
+ }
37
+
31
38
  .ds-group-header__right-link,
32
39
  .ds-group-header__icon,
33
40
  .ds-btn-toggle {
@@ -58,6 +65,18 @@
58
65
  color: var(--group-header-icon-color);
59
66
  }
60
67
 
68
+ .ds-group-header__direkt-circle {
69
+ position: absolute;
70
+ width: 100%;
71
+ height: 100%;
72
+
73
+ $centerDotRadius: 5px;
74
+
75
+ .ds-direkt-circle {
76
+ transform: translate(calc(-50% - $centerDotRadius), calc(-50% - $centerDotRadius));
77
+ }
78
+ }
79
+
61
80
  .ds-group-header__href {
62
81
  display: flex;
63
82
  align-items: center;
@@ -95,4 +114,8 @@
95
114
  &--bautaxl .ds-group-header__title {
96
115
  @include ds-typography($ds-typography-detailbaota-xl-label);
97
116
  }
117
+
118
+ &--direkt .ds-group-header__title {
119
+ z-index: 5;
120
+ }
98
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "8.6.1",
3
+ "version": "8.7.0",
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",