@bonniernews/dn-design-system-web 20.4.4 → 20.5.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 +14 -0
- package/components/empty-state/README-UXD.md +0 -0
- package/components/empty-state/README.md +40 -0
- package/components/empty-state/empty-state.njk +62 -0
- package/components/empty-state/empty-state.scss +35 -0
- package/components/pagination/pagination.scss +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [20.5.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@20.4.5...@bonniernews/dn-design-system-web@20.5.0) (2024-09-26)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **web:** empty state component ([#1411](https://github.com/BonnierNews/dn-design-system/issues/1411)) ([41e01c9](https://github.com/BonnierNews/dn-design-system/commit/41e01c9ca7bf102596249ffc579128e38a9bd533))
|
|
13
|
+
|
|
14
|
+
## [20.4.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@20.4.4...@bonniernews/dn-design-system-web@20.4.5) (2024-09-26)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **web:** pagination border-box ([#1412](https://github.com/BonnierNews/dn-design-system/issues/1412)) ([c4236fe](https://github.com/BonnierNews/dn-design-system/commit/c4236fe62e17b2655d3c50266e879515f89baada))
|
|
20
|
+
|
|
7
21
|
## [20.4.4](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@20.4.3...@bonniernews/dn-design-system-web@20.4.4) (2024-09-23)
|
|
8
22
|
|
|
9
23
|
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/basic/empty-state](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/basic/empty-state)
|
|
2
|
+
- Storybook: [EmptyState](https://designsystem.dn.se/?path=/docs/basic-emptystate--docs)
|
|
3
|
+
- Storybook (Latest): [EmptyState](https://designsystem-latest.dn.se/?path=/docs/basic-emptystate--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# Empty state
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
| iconName | String | no | add, arrow_back, delete etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
14
|
+
| title | String | no | | | Title for empty state |
|
|
15
|
+
| body | String | no | | | Describing text |
|
|
16
|
+
| brandButton | Object | no | text | | Object with text, href (optional), classNames (optional) and attributes (optional).|
|
|
17
|
+
| primaryButton | Object | no | text | | Object with text, href (optional), classNames (optional) and attributes (optional) |
|
|
18
|
+
| classNames | String | no | | | Ex. "my-special-class" |
|
|
19
|
+
| attributes | Object | no | | | Ex. { data-prop: value } |
|
|
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/empty-state/empty-state.njk' import EmptyState %}
|
|
29
|
+
|
|
30
|
+
{{ EmptyState({
|
|
31
|
+
iconName: "delete",
|
|
32
|
+
title: "Attans då...",
|
|
33
|
+
body: "Din sökning gav tyvärr inga träffar.",
|
|
34
|
+
})}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### SCSS
|
|
38
|
+
```scss
|
|
39
|
+
@use "@bonniernews/dn-design-system-web/basic/empty-state/empty-state" as *;
|
|
40
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/components/pictogram/pictogram.njk' import Pictogram %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
3
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
4
|
+
|
|
5
|
+
{% macro EmptyState(params) %}
|
|
6
|
+
{% set componentClassName = "ds-empty-state" %}
|
|
7
|
+
|
|
8
|
+
{%- set classes = [
|
|
9
|
+
componentClassName,
|
|
10
|
+
params.classNames if params.classNames
|
|
11
|
+
] | join(" ") %}
|
|
12
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
13
|
+
|
|
14
|
+
<div class="{{ classes }}" {{- attributes | safe }}>
|
|
15
|
+
{% if params.iconName %}
|
|
16
|
+
{{ Pictogram({
|
|
17
|
+
variant: "brand",
|
|
18
|
+
size: "large",
|
|
19
|
+
iconName: params.iconName,
|
|
20
|
+
attributes: { "aria-label": params.body if params.body else "" }
|
|
21
|
+
})}}
|
|
22
|
+
{% endif %}
|
|
23
|
+
|
|
24
|
+
<div class="{{ componentClassName + '__text' }}">
|
|
25
|
+
{% if params.title %}
|
|
26
|
+
<h2>{{ params.title }}</h2>
|
|
27
|
+
{% endif %}
|
|
28
|
+
{% if params.body %}
|
|
29
|
+
<span class="{{ componentClassName + '__body' }}">{{ params.body }}</span>
|
|
30
|
+
{% endif %}
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
{% if params.brandButton or params.primaryButton %}
|
|
34
|
+
<div class="{{ componentClassName + '__button-wrapper' }}">
|
|
35
|
+
{% if params.brandButton %}
|
|
36
|
+
{{ Button({
|
|
37
|
+
text: params.brandButton.text,
|
|
38
|
+
variant: "brand",
|
|
39
|
+
href: params.brandButton.href,
|
|
40
|
+
classNames: params.brandButton.classNames,
|
|
41
|
+
attributes: params.brandButton.attributes,
|
|
42
|
+
forcePx: params.forcePx,
|
|
43
|
+
fullWidth: true
|
|
44
|
+
})}}
|
|
45
|
+
{% endif %}
|
|
46
|
+
|
|
47
|
+
{% if params.primaryButton %}
|
|
48
|
+
{{ Button({
|
|
49
|
+
text: params.primaryButton.text,
|
|
50
|
+
variant: "primary",
|
|
51
|
+
emphasis: "outline",
|
|
52
|
+
href: params.primaryButton.href,
|
|
53
|
+
classNames: params.primaryButton.classNames,
|
|
54
|
+
attributes: params.primaryButton.attributes,
|
|
55
|
+
forcePx: params.forcePx,
|
|
56
|
+
fullWidth: true
|
|
57
|
+
})}}
|
|
58
|
+
{% endif %}
|
|
59
|
+
</div>
|
|
60
|
+
{% endif %}
|
|
61
|
+
</div>
|
|
62
|
+
{% endmacro %}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../components/pictogram/pictogram.scss" as *;
|
|
3
|
+
@use "../../components/button/button.scss" as *;
|
|
4
|
+
|
|
5
|
+
.ds-empty-state {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
text-align: center;
|
|
10
|
+
|
|
11
|
+
.ds-empty-state__text {
|
|
12
|
+
margin-top: ds-spacing($ds-s-100);
|
|
13
|
+
|
|
14
|
+
h2 {
|
|
15
|
+
@include ds-typography($ds-typography-functionalheading03);
|
|
16
|
+
color: $ds-color-text-primary;
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ds-empty-state__body {
|
|
21
|
+
@include ds-typography($ds-typography-functionalbody02);
|
|
22
|
+
display: block;
|
|
23
|
+
color: $ds-color-text-primary-02;
|
|
24
|
+
margin-top: ds-spacing($ds-s-025);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-empty-state__button-wrapper {
|
|
29
|
+
margin-top: ds-spacing($ds-s-100);
|
|
30
|
+
|
|
31
|
+
.ds-btn + .ds-btn {
|
|
32
|
+
margin-top: ds-spacing($ds-s-050);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED