@bonniernews/dn-design-system-web 4.1.0-alpha.1 → 4.1.0-alpha.2
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
|
+
## 4.1.0-alpha.2 (2023-08-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** implement the groupheader component ([#961](https://github.com/BonnierNews/dn-design-system/issues/961)) ([7767031](https://github.com/BonnierNews/dn-design-system/commit/77670310626cbbe1516e5fd0937c300c6938dbcb))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 4.1.0-alpha.1 (2023-08-24)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|selectedText | String | yes | | | |
|
|
16
16
|
|disabled | bool | no | true, false | false | |
|
|
17
17
|
|variant | String | no | brand, SecondaryFilled | brand | Design variant |
|
|
18
|
-
|size| String | no | default, small | default | |
|
|
18
|
+
|size| String | no | default, small, xsmall | default | |
|
|
19
19
|
|fullWidth | bool | no | true, false | false | Button will be full width on both desktop and mobile |
|
|
20
20
|
|condensed | bool | no | true, false | false | Condensed reduces spacing to a bare minimum, use with care since this might make touch target area smaller than recommended size |
|
|
21
21
|
|mobile.fullWidth | bool | no | true, false | false | Ex mobile: { fullWidth: true } |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/group-header](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/group-header)
|
|
2
|
+
- Storybook: [GroupHeader](https://designsystem.dn.se/?path=/docs/basic-groupheader--docs)
|
|
3
|
+
- Storybook (Latest): [GroupHeader](https://designsystem.dn.se/?path=/docs/basic-groupheader--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# GroupHeader
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | string | yes | | | The title text |
|
|
14
|
+
|variant | string | no | icon, link, toggle | icon | The variant to render |
|
|
15
|
+
|href | string | no | | | If given, the title is rendered as a link. Only available for variants `icon` and `link` |
|
|
16
|
+
|linkText | string | no | | | The link text to render (only for variant `link`) |
|
|
17
|
+
|toggle | object | no | | | Arguments to the ToggleButton (only for variant `toggle`) |
|
|
18
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
19
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
20
|
+
|
|
21
|
+
Depending on variant, only one of `toggle`, `linkText` is allowed. In `icon` and `link` mode, the `href` is required to show the ornament.
|
|
22
|
+
|
|
23
|
+
## Minimum requirement example
|
|
24
|
+
|
|
25
|
+
### Nunjucks
|
|
26
|
+
|
|
27
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
{% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
|
|
31
|
+
|
|
32
|
+
{{ call GroupHeader({
|
|
33
|
+
title: "Dagens Nyheter",
|
|
34
|
+
href: "https://www.dn.se/"
|
|
35
|
+
}) }}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### SCSS
|
|
39
|
+
```scss
|
|
40
|
+
@use "@bonniernews/dn-design-system-web/components/group-header/group-header";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### JS
|
|
44
|
+
If you provide the `toggle` parameter, you might need to initiate that component, [as per the documentation](https://designsystem.dn.se/?path=/readmetab/basic-buttons-buttontoggle--docs).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
3
|
+
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
4
|
+
|
|
5
|
+
{% macro GroupHeader(params) %}
|
|
6
|
+
{% set componentClassName = "ds-group-header" %}
|
|
7
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
+
{% set variant = [] %}
|
|
9
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
10
|
+
|
|
11
|
+
{% if params.classNames %}
|
|
12
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
13
|
+
{% endif%}
|
|
14
|
+
|
|
15
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
16
|
+
|
|
17
|
+
{% set groupHeaderInner %}
|
|
18
|
+
<h2 class="{{ componentClassName + '__title'}}">{{ params.title}}</h2>
|
|
19
|
+
|
|
20
|
+
{% if params.variant == 'toggle' and params.toggle %}
|
|
21
|
+
{# Could we add defaults here? #}
|
|
22
|
+
{{ ButtonToggle(params.toggle) }}
|
|
23
|
+
{% elif params.variant == 'link' and params.linkText and params.href %}
|
|
24
|
+
<span class="{{ componentClassName + '__right-link' }}">
|
|
25
|
+
{{ params.linkText }}
|
|
26
|
+
</span>
|
|
27
|
+
{% elif (params.variant == 'icon' or not params.variant) and params.href %}
|
|
28
|
+
{{ IconUse({ icon: "arrow_forward" }) }}
|
|
29
|
+
{% endif %}
|
|
30
|
+
{% endset %}
|
|
31
|
+
|
|
32
|
+
{% if (params.variant == 'link' or params.variant == 'icon' or not params.variant) and params.href %}
|
|
33
|
+
<a class="{{ classes }} {{ componentClassName + '--link'}}" href="{{ params.titleHref }}" {{ attributes | safe }}>
|
|
34
|
+
{{ groupHeaderInner | safe }}
|
|
35
|
+
</a>
|
|
36
|
+
{% else %}
|
|
37
|
+
<div class="{{ classes }}" {{ attributes | safe }}>
|
|
38
|
+
{{ groupHeaderInner | safe }}
|
|
39
|
+
</div>
|
|
40
|
+
{% endif %}
|
|
41
|
+
|
|
42
|
+
{% endmacro %}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../button-toggle/button-toggle.scss";
|
|
3
|
+
|
|
4
|
+
.ds-group-header {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
background: $ds-color-background-primary;
|
|
9
|
+
color: $ds-color-text-primary;
|
|
10
|
+
padding: ds-spacing-component(0 $ds-sc-x4);
|
|
11
|
+
@include ds-typography($ds-typography-functional-body02regular);
|
|
12
|
+
|
|
13
|
+
.ds-group-header__right-link,
|
|
14
|
+
.ds-btn-toggle,
|
|
15
|
+
.ds-icon {
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-group-header__right-link {
|
|
20
|
+
@include ds-link($ds-link-paragraph);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-icon {
|
|
24
|
+
height: 24px;
|
|
25
|
+
width: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.ds-group-header--link {
|
|
29
|
+
@include ds-link($ds-link-list);
|
|
30
|
+
|
|
31
|
+
@include ds-hover(true) {
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
|
|
34
|
+
.ds-group-header__title {
|
|
35
|
+
@include ds-underline(1px, 2px);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ds-group-header__right-link {
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ds-group-header__title {
|
|
45
|
+
padding: ds-spacing-component($ds-sc-x3 0);
|
|
46
|
+
@include ds-typography($ds-typography-functional-body02bold);
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/package.json
CHANGED