@bonniernews/dn-design-system-web 2.1.0-alpha.5 → 2.1.0-alpha.6
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 +9 -0
- package/components/quote/README.md +36 -0
- package/components/quote/quote.njk +29 -0
- package/components/quote/quote.scss +33 -0
- package/package.json +1 -1
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
|
+
## [2.1.0-alpha.6](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.5...@bonniernews/dn-design-system-web@2.1.0-alpha.6) (2023-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** quote component for web ([#675](https://github.com/BonnierNews/dn-design-system/issues/675)) ([599c7d9](https://github.com/BonnierNews/dn-design-system/commit/599c7d9012b7a9677c31b42196189c6b8bba04e3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [2.1.0-alpha.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.4...@bonniernews/dn-design-system-web@2.1.0-alpha.5) (2023-02-20)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/quote](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/quote)
|
|
2
|
+
- Storybook: [Quote > Web](https://designsystem.dn.se/?path=/story/components-app-web-quote-web)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# Quote
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|bodyHtml | HTML String | yes | | | |
|
|
13
|
+
|variant | String | no | standard, culture, sport, economy | standard | Design variant |
|
|
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/quote/quote.njk' import Quote %}
|
|
26
|
+
|
|
27
|
+
{{ Quote({
|
|
28
|
+
variant: "culture",
|
|
29
|
+
bodyHtml: ""
|
|
30
|
+
})}}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### SCSS
|
|
34
|
+
```scss
|
|
35
|
+
@use "@bonniernews/dn-design-system-web/components/quote/quote";
|
|
36
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro Quote(params) %}
|
|
4
|
+
{% set componentClassName = "ds-quote" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set variant = [] %}
|
|
7
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{% if params.forcePx %}
|
|
10
|
+
{% set variant = (variant.push("ds-force-px"), variant) %}
|
|
11
|
+
{% endif %}
|
|
12
|
+
|
|
13
|
+
{% if params.variant %}
|
|
14
|
+
{% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
|
|
15
|
+
{% else %}
|
|
16
|
+
{% set variant = (variant.push(classNamePrefix + "standard"), variant) %}
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{% if params.classNames %}
|
|
20
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
21
|
+
{% endif%}
|
|
22
|
+
|
|
23
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
24
|
+
|
|
25
|
+
<blockquote class="{{ classes }}" {{- attributes | safe }}>
|
|
26
|
+
<span class="{{ componentClassName + '__border'}}"></span>
|
|
27
|
+
{{ params.bodyHtml | safe }}
|
|
28
|
+
</blockquote>
|
|
29
|
+
{% endmacro %}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-quote {
|
|
4
|
+
@include ds-typography($ds-typography-expressive-heading03bold);
|
|
5
|
+
color: $ds-color-text-primary;
|
|
6
|
+
margin: ds-spacing-layout(
|
|
7
|
+
gap-vertical-static-medium 0 gap-vertical-static-large
|
|
8
|
+
);
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
@at-root .ds-force-px#{&} {
|
|
12
|
+
@include ds-typography($ds-typography-expressive-heading03bold, true);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-quote__border {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 40px;
|
|
18
|
+
height: 8px;
|
|
19
|
+
color: $ds-color-component-brand;
|
|
20
|
+
background: currentColor;
|
|
21
|
+
margin: ds-spacing-component(0 0 x2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&--culture .ds-quote__border {
|
|
25
|
+
color: $ds-color-static-kultur;
|
|
26
|
+
}
|
|
27
|
+
&--sport .ds-quote__border {
|
|
28
|
+
color: $ds-color-static-sport;
|
|
29
|
+
}
|
|
30
|
+
&--economy .ds-quote__border {
|
|
31
|
+
color: $ds-color-static-economy;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
CHANGED