@bonniernews/dn-design-system-web 8.5.0 → 8.6.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.6.0 (2023-11-22)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** add quiz header component ([#1102](https://github.com/BonnierNews/dn-design-system/issues/1102)) ([4f8b2f2](https://github.com/BonnierNews/dn-design-system/commit/4f8b2f2e1d9c7987ed0291645d5c4595d2332007))
12
+
13
+
14
+
6
15
  ## 8.5.0 (2023-11-22)
7
16
 
8
17
 
@@ -0,0 +1,39 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/game-header](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/game-header)
2
+ - Storybook: [GameHeader](https://designsystem.dn.se/?path=/docs/section-Gameheader--docs)
3
+ - Storybook (Latest): [GameHeader](https://designsystem-latest.dn.se/?path=/docs/section-Gameheader--docs)
4
+
5
+ ----
6
+
7
+ # Game header
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |title | String | yes | | | Text displayed on the header |
14
+ |media | String | no | | | URL to icon displayed on the header |
15
+ |descriptionHtml | String | no | | | Intended use is text, links and inlined icons |
16
+ |backgroundColor | String | no | | | Hex code or supported color name |
17
+ |classNames | String | no | | | Ex. "my-special-class" |
18
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
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/game-header/game-header.njk' import GameHeader %}
28
+
29
+ {{ GameHeader(
30
+ {
31
+ title: "Quiz"
32
+ }
33
+ )}}
34
+ ```
35
+
36
+ ### SCSS
37
+ ```scss
38
+ @use "@bonniernews/dn-design-system-web/components/game-header/game-header" as *;
39
+ ```
@@ -0,0 +1,33 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+
3
+ {% macro GameHeader(params) %}
4
+ {%- set componentClassName = "ds-game-header" %}
5
+ {% set attributes = getAttributes(params.attributes) %}
6
+
7
+ {%- set classes = [
8
+ componentClassName,
9
+ params.classNames if params.classNames
10
+ ] | join(" ") %}
11
+
12
+ <div class="{{ classes }}" {{- attributes | safe }}>
13
+ <div class="{{ componentClassName }}__top ds-light" style="backgroundColor: {{params.backgroundColor}}">
14
+ <div class="{{ componentClassName }}__top-content">
15
+ <h2 class="{{ componentClassName }}__title">{{ params.title}}</h2>
16
+
17
+ {% if params.media %}
18
+ <div class="{{ componentClassName + '__media'}}">
19
+ {{ params.media | safe }}
20
+ </div>
21
+ {% endif %}
22
+ </div>
23
+ </div>
24
+
25
+ {% if params.descriptionHtml %}
26
+ <div class="{{ componentClassName }}__description">
27
+ <div class="{{ componentClassName }}__description-content">
28
+ {{ params.descriptionHtml | safe }}
29
+ </div>
30
+ </div>
31
+ {% endif %}
32
+ </div>
33
+ {% endmacro %}
@@ -0,0 +1,51 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-game-header {
5
+ width: 100%;
6
+
7
+ .ds-game-header__top {
8
+ background-color: $ds-color-surface-background;
9
+ }
10
+
11
+ .ds-game-header__top-content {
12
+ display: flex;
13
+ align-items: baseline;
14
+ justify-content: space-between;
15
+ padding: ds-spacing($ds-s-100);
16
+ }
17
+
18
+ .ds-game-header__top-content,
19
+ .ds-game-header__description-content {
20
+ max-width: var(--ds-game-header-content-width, 100%);
21
+ margin: 0 auto;
22
+ }
23
+
24
+ .ds-game-header__title {
25
+ @include ds-typography($ds-typography-functional-heading03bold);
26
+ color: $ds-color-text-primary;
27
+ margin: 0;
28
+ }
29
+ .ds-game-header__media {
30
+ margin-right: ds-spacing($ds-s-100);
31
+ }
32
+
33
+ .ds-game-header__description {
34
+ background-color: $ds-color-surface-background;
35
+ }
36
+
37
+ .ds-game-header__description-content {
38
+ @include ds-typography($ds-typography-functional-body02regular);
39
+ padding: ds-spacing($ds-s-025 $ds-s-100);
40
+ color: $ds-color-text-primary;
41
+
42
+ a {
43
+ @include ds-link($ds-link-article-body);
44
+ }
45
+
46
+ b,
47
+ strong {
48
+ @include ds-typography($ds-typography-functional-body02semibold);
49
+ }
50
+ }
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "8.5.0",
3
+ "version": "8.6.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",