@bonniernews/dn-design-system-web 3.0.0-alpha.29 → 3.0.0-alpha.30
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
|
+
## 3.0.0-alpha.30 (2023-04-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** vip badge component ([#759](https://github.com/BonnierNews/dn-design-system/issues/759)) ([7d0791e](https://github.com/BonnierNews/dn-design-system/commit/7d0791ee9d101265ec5f5427b550da783afff93e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 3.0.0-alpha.29 (2023-04-19)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/vip-badge](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/vip-badge)
|
|
2
|
+
- Storybook: [VipBadge > Web > Vip Badge](https://designsystem.dn.se/?path=/story/components-app-web-vipbadge-web--vip-badge)
|
|
3
|
+
- Storybook: [VipBadge > Web > Vip Badge With Text](https://designsystem.dn.se/?path=/story/components-app-web-vipbadge-web--vip-badge-with-text)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# VipBadge
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|text | string | no | | | |
|
|
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/vip-badge/vip-badge.njk' import VipBadge %}
|
|
26
|
+
|
|
27
|
+
{{ VipBadge({
|
|
28
|
+
text: "För dig som prenumererar"
|
|
29
|
+
})}}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### SCSS
|
|
33
|
+
```scss
|
|
34
|
+
@use "@bonniernews/dn-design-system-web/components/vip-badge/vip-badge" as *;
|
|
35
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
3
|
+
|
|
4
|
+
{% macro VipBadge(params) %}
|
|
5
|
+
{%- set componentClassName = "ds-vip-badge" %}
|
|
6
|
+
{%- set classNamePrefix = componentClassName + "--" %}
|
|
7
|
+
{%- set additionalClasses = [] %}
|
|
8
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
{%- if params.classNames %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
11
|
+
{% endif %}
|
|
12
|
+
{%- if params.text %}
|
|
13
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + "text"), additionalClasses) %}
|
|
14
|
+
{% endif%}
|
|
15
|
+
{%- if params.forcePx %}
|
|
16
|
+
{% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
17
|
+
{% endif %}
|
|
18
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
19
|
+
<div class="{{ classes }}" {{- attributes | safe }} aria-hidden="true">
|
|
20
|
+
{{ Icon({ icon: 'vip' | safe }) }}
|
|
21
|
+
{%- if params.text %}
|
|
22
|
+
{{ params.text }}
|
|
23
|
+
{% endif %}
|
|
24
|
+
</div>
|
|
25
|
+
{% endmacro %}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
$ds-vip-badge__icon-size: 16px;
|
|
4
|
+
|
|
5
|
+
.ds-vip-badge {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
box-sizing: content-box;
|
|
9
|
+
border-radius: ds-px-to-rem(ds-metrics-border-radius(x1));
|
|
10
|
+
background-color: $ds-color-static-green-100;
|
|
11
|
+
color: $ds-color-static-black;
|
|
12
|
+
fill: $ds-color-static-black;
|
|
13
|
+
@include ds-typography($ds-typography-functional-meta01regular);
|
|
14
|
+
padding: ds-px-to-rem(ds-spacing-component($ds-sc-x1))
|
|
15
|
+
ds-px-to-rem(ds-spacing-component($ds-sc-x2));
|
|
16
|
+
|
|
17
|
+
@at-root .ds-force-px#{&} {
|
|
18
|
+
@include ds-typography($ds-typography-functional-meta01regular, true);
|
|
19
|
+
padding: ds-spacing-component($ds-sc-x1 $ds-sc-x2);
|
|
20
|
+
border-radius: ds-metrics-border-radius(x1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-icon {
|
|
24
|
+
height: ds-px-to-rem($ds-vip-badge__icon-size);
|
|
25
|
+
width: ds-px-to-rem($ds-vip-badge__icon-size);
|
|
26
|
+
@at-root .ds-force-px#{&} {
|
|
27
|
+
height: $ds-vip-badge__icon-size;
|
|
28
|
+
width: $ds-vip-badge__icon-size;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-vip-badge--text {
|
|
34
|
+
.ds-icon {
|
|
35
|
+
margin-right: ds-px-to-rem(ds-spacing-component($ds-sc-x1));
|
|
36
|
+
@at-root .ds-force-px#{&} {
|
|
37
|
+
margin-right: ds-spacing-component($ds-sc-x1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonniernews/dn-design-system-web",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.30",
|
|
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",
|