@bonniernews/dn-design-system-web 3.0.0-alpha.4 → 3.0.0-alpha.5
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.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.4...@bonniernews/dn-design-system-web@3.0.0-alpha.5) (2023-03-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** video caption component ([#706](https://github.com/BonnierNews/dn-design-system/issues/706)) ([a64278a](https://github.com/BonnierNews/dn-design-system/commit/a64278a64840e2422baed278b7bae29055dabf78))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [3.0.0-alpha.4](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.3...@bonniernews/dn-design-system-web@3.0.0-alpha.4) (2023-03-08)
|
|
7
16
|
|
|
8
17
|
|
package/README.md
CHANGED
|
@@ -10,4 +10,4 @@ Storybook latest: [https://designsystem-latest.dn.se/](https://designsystem-late
|
|
|
10
10
|
|
|
11
11
|
Github: [https://github.com/BonnierNews/dn-design-system/tree/main/web/src](https://github.com/BonnierNews/dn-design-system/tree/main/web/src)
|
|
12
12
|
|
|
13
|
-
For specific instructions see each component or helper readme
|
|
13
|
+
For specific instructions see each component or helper readme
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/video-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/video-caption)
|
|
2
|
+
- Storybook (PROD): [VideoCaption > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-videocaption-web--video-caption)
|
|
3
|
+
- Storybook (LATEST): [VideoCaption > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-article-components-videocaption-web--video-caption)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# VideoCaption
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|caption | String | no | | | |
|
|
14
|
+
|duration | String | no | | | |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
|
|
18
|
+
|
|
19
|
+
## Minimum requirement example
|
|
20
|
+
|
|
21
|
+
### Nunjucks
|
|
22
|
+
|
|
23
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
{% from '@bonniernews/dn-design-system-web/components/video-caption/video-caption.njk' import VideoCaption %}
|
|
27
|
+
|
|
28
|
+
{{ VideoCaption({
|
|
29
|
+
caption: "Tre år har gått sedan terrordåden i Paris.",
|
|
30
|
+
duration: "47 sek."
|
|
31
|
+
}) }}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### SCSS
|
|
35
|
+
```scss
|
|
36
|
+
@use "@bonniernews/dn-design-system-web/components/video-caption/video-caption";
|
|
37
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro VideoCaption(params) %}
|
|
4
|
+
{%- set componentClassName = "ds-video-caption" %}
|
|
5
|
+
{%- set additionalClasses = [] %}
|
|
6
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
7
|
+
{%- if params.forcePx %}
|
|
8
|
+
{%- set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
|
|
9
|
+
{% endif %}
|
|
10
|
+
{%- if params.classNames %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
12
|
+
{% endif%}
|
|
13
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
14
|
+
<figcaption class="{{ classes }}" {{- attributes | safe }}>
|
|
15
|
+
{%- if params.duration %}
|
|
16
|
+
<span class="{{ componentClassName + '__duration'}}">
|
|
17
|
+
{{- params.duration -}}
|
|
18
|
+
</span>
|
|
19
|
+
{% endif %}
|
|
20
|
+
{%- if params.caption %}
|
|
21
|
+
{{- params.caption -}}
|
|
22
|
+
{% endif %}
|
|
23
|
+
</figcaption>
|
|
24
|
+
{% endmacro %}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-video-caption {
|
|
4
|
+
@include ds-typography($ds-typography-functional-body01regular);
|
|
5
|
+
color: $ds-color-text-primary;
|
|
6
|
+
|
|
7
|
+
.ds-video-caption__duration {
|
|
8
|
+
@include ds-typography($ds-typography-functional-body01bold);
|
|
9
|
+
margin-right: ds-spacing-component(x1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@at-root .ds-force-px#{&} {
|
|
13
|
+
@include ds-typography($ds-typography-functional-body01regular, true);
|
|
14
|
+
.ds-video-caption__duration {
|
|
15
|
+
@include ds-typography($ds-typography-functional-body01bold, true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
CHANGED