@bonniernews/dn-design-system-web 3.0.0-alpha.41 → 3.0.0-alpha.42
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.42](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.41...@bonniernews/dn-design-system-web@3.0.0-alpha.42) (2023-05-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** onsite teaser - dn på plats ([#783](https://github.com/BonnierNews/dn-design-system/issues/783)) ([42603af](https://github.com/BonnierNews/dn-design-system/commit/42603af21bd6511f858f2b7acc889067584cbf93))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [3.0.0-alpha.41](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.40...@bonniernews/dn-design-system-web@3.0.0-alpha.41) (2023-05-03)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-onsite](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-onsite)
|
|
2
|
+
- Storybook (PROD): [TeaserOnSite > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaseronsite-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserOnSite > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaseronsite-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-onsite
|
|
8
|
+
|
|
9
|
+
Also known as "På Plats-puffen".
|
|
10
|
+
|
|
11
|
+
In the CMS title will be set to a location like "Kiev, Ukraina" or "USA" and text is usually set to some author names like "Jan Banan och Kalle Kula"
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
|parameter | type | required | options | default | description |
|
|
16
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
17
|
+
|title | String | yes | | | Heading of the teaser |
|
|
18
|
+
|targetLink | String | yes | | | Target URL for the teaser |
|
|
19
|
+
|targetId | String | no | | | Target article ID |
|
|
20
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
21
|
+
|text | String | no | | | Teaser subtext |
|
|
22
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
23
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
24
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
25
|
+
|~forcePx~ | | | | | Not supported |
|
|
26
|
+
|
|
27
|
+
## Minimum requirement example
|
|
28
|
+
|
|
29
|
+
### Nunjucks
|
|
30
|
+
|
|
31
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-onsite/teaser-onsite.njk' import TeaserOnSite %}
|
|
35
|
+
|
|
36
|
+
{{ TeaserOnSite({
|
|
37
|
+
title: 'Kiev, Ukraina',
|
|
38
|
+
text: 'Henrik Brandão Jönsson och Eduardo Leal'
|
|
39
|
+
})}}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### SCSS
|
|
43
|
+
```scss
|
|
44
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-onsite/teaser-onsite" as *;
|
|
45
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserOnSite(params) %}
|
|
4
|
+
{% set componentClassName = "ds-teaser" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set additionalClasses = ["ds-teaser--onsite"] %}
|
|
7
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{% if params.theme %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
11
|
+
{% endif %}
|
|
12
|
+
|
|
13
|
+
{% if params.classNames %}
|
|
14
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
15
|
+
{% endif%}
|
|
16
|
+
|
|
17
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
18
|
+
|
|
19
|
+
<a href="{{ params.targetLink }}"
|
|
20
|
+
class="{{ classes }}"
|
|
21
|
+
{% if targetId %} data-id="{{ params.targetId }}" {% endif %}
|
|
22
|
+
{{- attributes | safe }}>
|
|
23
|
+
|
|
24
|
+
{% if params.mediaHtml %}
|
|
25
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
26
|
+
{{ params.mediaHtml }}
|
|
27
|
+
</div>
|
|
28
|
+
{% endif %}
|
|
29
|
+
|
|
30
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
31
|
+
<h2 class="ds-teaser__title">
|
|
32
|
+
DN PÅ PLATS {{ params.title | safe }}
|
|
33
|
+
</h2>
|
|
34
|
+
|
|
35
|
+
{% if params.text %}
|
|
36
|
+
<p class="{{ componentClassName + '__text'}}">
|
|
37
|
+
{{ params.text | safe }}
|
|
38
|
+
</p>
|
|
39
|
+
{% endif %}
|
|
40
|
+
</div>
|
|
41
|
+
</a>
|
|
42
|
+
{% endmacro %}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-teaser.ds-teaser--onsite {
|
|
5
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
|
|
6
|
+
background-image: var(
|
|
7
|
+
--ds-onsite-background-image-url
|
|
8
|
+
); //Set by parent context (like Storybook or Bang)
|
|
9
|
+
background-position: 100%;
|
|
10
|
+
background-repeat: no-repeat;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
|
|
13
|
+
.ds-teaser__title {
|
|
14
|
+
color: $ds-theme-color;
|
|
15
|
+
@include ds-typography($ds-typography-detailarticle-label);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-teaser__text {
|
|
19
|
+
margin-top: 0;
|
|
20
|
+
@include ds-typography($ds-typography-functional-heading01bold);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-teaser__media {
|
|
24
|
+
float: left;
|
|
25
|
+
margin-right: ds-spacing-component($ds-sc-x4);
|
|
26
|
+
width: 56px;
|
|
27
|
+
height: 56px;
|
|
28
|
+
}
|
|
29
|
+
}
|
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.42",
|
|
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",
|