@bonniernews/dn-design-system-web 3.0.0-alpha.1 → 3.0.0-alpha.3

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
+ ## [3.0.0-alpha.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.2...@bonniernews/dn-design-system-web@3.0.0-alpha.3) (2023-03-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** article image ([#697](https://github.com/BonnierNews/dn-design-system/issues/697)) ([e3e9cec](https://github.com/BonnierNews/dn-design-system/commit/e3e9cecd96f4d6240854ffc593a082f7d6c66793))
12
+
13
+
14
+
15
+ ## [3.0.0-alpha.2](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.1...@bonniernews/dn-design-system-web@3.0.0-alpha.2) (2023-03-06)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **web:** use large screen spacing on tablet ([#718](https://github.com/BonnierNews/dn-design-system/issues/718)) ([42f6dc7](https://github.com/BonnierNews/dn-design-system/commit/42f6dc79c03f2cca823921b07d9ec5855628625a))
21
+
22
+
23
+
6
24
  ## [3.0.0-alpha.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.0...@bonniernews/dn-design-system-web@3.0.0-alpha.1) (2023-03-06)
7
25
 
8
26
 
@@ -0,0 +1,33 @@
1
+ {% macro ArticleImage(params) %}
2
+ {% set macroClassName = "ds-article-image" %}
3
+ {% set additionalClasses = [] %}
4
+
5
+ {% if params.classNames %}
6
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
7
+ {% endif %}
8
+
9
+ {% set classes = macroClassName + " " + additionalClasses | join(" ") %}
10
+
11
+ <figure class="{{ classes }}" {{- params.attributes | safe }}>
12
+ {% if params.fullWidth %}
13
+ <div class="ds-full-width-element">
14
+ {{ params.imageHtml | safe }}
15
+ </div>
16
+ {% else %}
17
+ {{ params.imageHtml | safe }}
18
+ {% endif %}
19
+
20
+ {% if params.caption or params.author %}
21
+ <figcaption>
22
+ {% if params.caption %}
23
+ <span aria-hidden="true">{{ params.caption | safe }}</span>
24
+ {% endif %}
25
+ {% if params.author %}
26
+ <span class="ds-article-image__credits">
27
+ {%- if params.imageType %}{{ params.imageType | capitalize }}: {% endif %}{{ params.author -}}
28
+ </span>
29
+ {% endif %}
30
+ </figcaption>
31
+ {% endif %}
32
+ </figure>
33
+ {% endmacro %}
@@ -0,0 +1,20 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+
3
+ .ds-article-image {
4
+ margin: 0;
5
+
6
+ > figcaption {
7
+ @include ds-typography($ds-typography-functional-body01regular);
8
+ margin-top: ds-spacing-component(x2);
9
+ color: $ds-color-text-primary;
10
+
11
+ @at-root .ds-force-px#{&} {
12
+ @include ds-typography($ds-typography-functional-body01regular, true);
13
+ }
14
+
15
+ > .ds-article-image__credits {
16
+ display: block;
17
+ color: $ds-color-text-primary-02;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,42 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/article-body-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-body-image)
2
+ - Storybook: [Disclaimer > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-image-bodyimage-web--article-body-image)
3
+
4
+ ----
5
+
6
+ # ArticleBodyImage
7
+
8
+ ## Parameters
9
+
10
+ |parameter | type | required | options | default | description |
11
+ |:--- | :--- | :--- | :--- | :--- | :--- |
12
+ |imageHtml | String | yes | | | Use to populate figure tag with image information |
13
+ |fullWidth | Bool | no | true, false | false | Image will have styleable wrapping element |
14
+ |caption | String | no | | | Ex "Detta är en bildtext" |
15
+ |imageType | String | no | | | Type of image. Ex "Foto" |
16
+ |author | String | no | | | Ex "Paul Hansen" |
17
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
18
+ |classNames | String | no | | | Ex. "my-special-class" |
19
+ |forcePx | Bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
20
+
21
+ ## Minimum requirement example
22
+
23
+ ### Nunjucks
24
+
25
+ These are copy paste friendly examples to quickliy get started using a component.
26
+
27
+ ```html
28
+ {% from '@bonniernews/dn-design-system-web/components/article-body-image/article-body-image.njk' import ArticleBodyImage %}
29
+
30
+ {{ ArticleBodyImage({
31
+ imageHtml: exampleArticleBodyImageHtml(),
32
+ fullWidth: true,
33
+ caption: "En bildtext",
34
+ imageType: "Foto",
35
+ author: "Paul Hansen",
36
+ })}}
37
+ ```
38
+
39
+ ### SCSS
40
+ ```scss
41
+ @use "@bonniernews/dn-design-system-web/components/article-body-image/article-body-image";
42
+ ```
@@ -0,0 +1,23 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/assets/article-image/article-image.njk' import ArticleImage %}
3
+ {% set classes = [] %}
4
+
5
+ {% macro ArticleBodyImage(params) %}
6
+ {% set componentClassName = "ds-article-image--body" %}
7
+ {% set additionalClasses = [] %}
8
+ {% set attributes = getAttributes(params.attributes) %}
9
+
10
+ {% if params.classNames %}
11
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
12
+ {% endif %}
13
+
14
+ {% if params.forcePx %}
15
+ {% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
16
+ {% endif %}
17
+
18
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
19
+
20
+ {% set imageParams = { fullWidth: params.fullWidth, caption: params.caption, imageType: params.imageType, author: params.author, imageHtml: params.imageHtml, classNames: classes, attributes: attributes } %}
21
+
22
+ {% call ArticleImage(imageParams) %}{% endcall %}
23
+ {% endmacro %}
@@ -0,0 +1,8 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/article-image/article-image.scss" as *;
3
+
4
+ .ds-article-image--body {
5
+ @include ds-spacing-layout(
6
+ gap-vertical-static-medium 0 gap-vertical-static-large
7
+ );
8
+ }
@@ -0,0 +1,40 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/article-top-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-top-image)
2
+ - Storybook: [Disclaimer > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-image-topimage-web--article-top-image)
3
+
4
+ ----
5
+
6
+ # ArticleTopImage
7
+
8
+ ## Parameters
9
+
10
+ |parameter | type | required | options | default | description |
11
+ |:--- | :--- | :--- | :--- | :--- | :--- |
12
+ |imageHtml | String | yes | | | Use to populate figure tag with image information |
13
+ |caption | String | no | | | Ex "Detta är en bildtext" |
14
+ |imageType | String | no | | | Type of image. Ex "Foto" |
15
+ |author | String | no | | | Ex "Paul Hansen" |
16
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
17
+ |classNames | String | no | | | Ex. "my-special-class" |
18
+ |forcePx | Bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
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/article-top-image/article-top-image.njk' import ArticleTopImage %}
28
+
29
+ {{ ArticleTopImage({
30
+ imageHtml: exampleArticleTopImageHtml(),
31
+ caption: "En bildtext",
32
+ imageType: "Foto",
33
+ author: "Beatrice Lundborg",
34
+ })}}
35
+ ```
36
+
37
+ ### SCSS
38
+ ```scss
39
+ @use "@bonniernews/dn-design-system-web/components/article-top-image/article-top-image";
40
+ ```
@@ -0,0 +1,23 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/assets/article-image/article-image.njk' import ArticleImage %}
3
+ {% set classes = [] %}
4
+
5
+ {% macro ArticleTopImage(params) %}
6
+ {% set componentClassName = "ds-article-image--top" %}
7
+ {% set additionalClasses = [] %}
8
+ {% set attributes = getAttributes(params.attributes) %}
9
+
10
+ {% if params.classNames %}
11
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
12
+ {% endif %}
13
+
14
+ {% if params.forcePx %}
15
+ {% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
16
+ {% endif %}
17
+
18
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
19
+
20
+ {% set imageParams = { fullWidth: true, caption: params.caption, imageType: params.imageType, author: params.author, imageHtml: params.imageHtml, classNames: classes, attributes: attributes } %}
21
+
22
+ {% call ArticleImage(imageParams) %}{% endcall %}
23
+ {% endmacro %}
@@ -0,0 +1,6 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/article-image/article-image.scss" as *;
3
+
4
+ .ds-article-image--top {
5
+ @include ds-spacing-layout(gap-vertical-static-large, px, padding-bottom);
6
+ }
@@ -26,7 +26,7 @@
26
26
  ) {
27
27
  @if $units {
28
28
  $values: _ds-get-spacings($spacingLayout, $units, $sizeUnit, $negative);
29
- @include ds-mq-largest-breakpoint(tablet) {
29
+ @include ds-mq-largest-breakpoint(mobile) {
30
30
  #{$property}: $values;
31
31
  }
32
32
  $valuesLargeScreen: _ds-get-spacings(
@@ -35,7 +35,7 @@
35
35
  $sizeUnit,
36
36
  $negative
37
37
  );
38
- @include ds-mq-smallest-breakpoint(desktop) {
38
+ @include ds-mq-smallest-breakpoint(tablet) {
39
39
  #{$property}: $valuesLargeScreen;
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.3",
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",