@bonniernews/dn-design-system-web 2.0.0-alpha.0 → 2.1.0-alpha.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,23 @@
|
|
|
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
|
+
## [2.1.0-alpha.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.0.0...@bonniernews/dn-design-system-web@2.1.0-alpha.0) (2023-02-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** disclaimer component. ([#659](https://github.com/BonnierNews/dn-design-system/issues/659)) ([91992af](https://github.com/BonnierNews/dn-design-system/commit/91992af5590fa7d254e00e9857130bae4d4c504a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.0.0-alpha.0...@bonniernews/dn-design-system-web@2.0.0) (2023-02-14)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## 2.0.0-alpha.0 (2023-02-14)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/disclaimer](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/disclaimer)
|
|
2
|
+
- Storybook: [Disclaimer > Web](https://designsystem.dn.se/?path=/story/components-app-web-disclaimer-web)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# Disclaimer
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|bodyHtml | String | yes | | | Intended use is text, links and inlined icons |
|
|
13
|
+
|iconName | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icon-web--all |
|
|
14
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
15
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
16
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
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/disclaimer/disclaimer.njk' import Disclaimer %}
|
|
26
|
+
|
|
27
|
+
{{ Disclaimer({
|
|
28
|
+
bodyHtml: "<strong>Detta är</strong> en text publicerad på Dagens Nyheters ledarsidor. Ledarredaktionens politiska hållning är oberoende liberal."
|
|
29
|
+
})}}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### SCSS
|
|
33
|
+
```scss
|
|
34
|
+
@use "@bonniernews/dn-design-system-web/components/disclaimer/disclaimer";
|
|
35
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
|
|
2
|
+
|
|
3
|
+
{% macro Disclaimer(params) %}
|
|
4
|
+
{% set componentClassName = "ds-disclaimer" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set additionalClasses = [] %}
|
|
7
|
+
{% set attributes %}
|
|
8
|
+
{% for attribute, value in params.attributes %}
|
|
9
|
+
{{attribute}}="{{value}}"
|
|
10
|
+
{% endfor %}
|
|
11
|
+
{% endset %}
|
|
12
|
+
|
|
13
|
+
{% if params.forcePx %}
|
|
14
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if params.iconName %}
|
|
18
|
+
{% set iconSvg = Icon({ icon: params.iconName }) %}
|
|
19
|
+
{% set additionalClasses = (additionalClasses.push(componentClassName + "--with-icon"), additionalClasses) %}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{% if params.classNames %}
|
|
23
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
24
|
+
{% endif%}
|
|
25
|
+
|
|
26
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
27
|
+
|
|
28
|
+
<section class="{{ classes }}" {{- attributes | safe }}>
|
|
29
|
+
{% if iconSvg %}
|
|
30
|
+
<span class="{{ componentClassName + '__icon-wrapper'}}">{{- iconSvg | safe if iconSvg -}}</span>
|
|
31
|
+
{% endif %}
|
|
32
|
+
<div class="{{ componentClassName + '__body-html'}}">{{ params.bodyHtml | safe }}</div>
|
|
33
|
+
</section>
|
|
34
|
+
{% endmacro %}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
3
|
+
|
|
4
|
+
$ds-disclaimer__icon-size: 20px;
|
|
5
|
+
$ds-btn-outlined__border-width: ds-metrics-border-width(x1);
|
|
6
|
+
|
|
7
|
+
.ds-disclaimer {
|
|
8
|
+
padding: ds-spacing-component(x3 x4);
|
|
9
|
+
margin-bottom: ds-spacing-component(x4);
|
|
10
|
+
background-color: $ds-color-surface-raised;
|
|
11
|
+
|
|
12
|
+
&--with-icon {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ds-disclaimer__icon-wrapper {
|
|
18
|
+
margin-right: ds-spacing-component(x2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-disclaimer__body-html {
|
|
22
|
+
@include ds-typography($ds-typography-functional-body01regular);
|
|
23
|
+
margin: 0;
|
|
24
|
+
color: $ds-color-text-primary-02;
|
|
25
|
+
|
|
26
|
+
@at-root .ds-force-px#{&} {
|
|
27
|
+
@include ds-typography($ds-typography-functional-body01regular, true);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
a {
|
|
31
|
+
@include ds-link($ds-link-paragraph);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
strong {
|
|
35
|
+
@include ds-typography($ds-typography-functional-body01medium);
|
|
36
|
+
color: $ds-color-text-primary;
|
|
37
|
+
@at-root .ds-force-px#{&} {
|
|
38
|
+
@include ds-typography($ds-typography-functional-body01medium, true);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-icon {
|
|
44
|
+
position: relative;
|
|
45
|
+
display: flex;
|
|
46
|
+
height: ds-px-to-rem($ds-disclaimer__icon-size);
|
|
47
|
+
width: ds-px-to-rem($ds-disclaimer__icon-size);
|
|
48
|
+
margin: 0;
|
|
49
|
+
color: $ds-color-icon-primary;
|
|
50
|
+
@at-root .ds-force-px#{&} {
|
|
51
|
+
height: $ds-disclaimer__icon-size;
|
|
52
|
+
width: $ds-disclaimer__icon-size;
|
|
53
|
+
}
|
|
54
|
+
svg {
|
|
55
|
+
fill: currentColor;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/package.json
CHANGED