@gouvfr/dsfr-roller 1.0.12 → 1.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gouvfr/dsfr-roller",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Le module `dsfr-roller` permet de publier le site de documentation du Système de Design de l’État - DSFR",
5
5
  "keywords": [
6
6
  "Système de Design de l'État",
@@ -56,7 +56,7 @@
56
56
  ],
57
57
  "main": "./index.js",
58
58
  "dependencies": {
59
- "@gouvfr/dsfr-forge": "=1.0.12",
59
+ "@gouvfr/dsfr-forge": "=1.0.14",
60
60
  "@gouvfr/dsfr-publisher": "npm:@gouvfr/dsfr@1.13.1",
61
61
  "deepmerge": "^4.3.1",
62
62
  "ejs": "^3.1.10",
@@ -24,19 +24,26 @@ class CardContainerDirective extends Node {
24
24
 
25
25
  structureCard (data) {
26
26
  this._data = data;
27
- const horizontal = data.properties.horizontal === true;
28
- const download = data.properties.download === true;
29
27
  const image = Node.getImageChild(data);
30
28
  const contentChildren = data.children.filter(child => !Node.getImageChild(child));
31
29
  const contentTitle = contentChildren.find(child => child.type === 'heading');
32
30
  const contentDescription = contentChildren.find(child => child.type === 'paragraph');
33
31
  const hintStart = this.structureHintStart;
34
32
  const hintEnd = this.structureHintEnd;
33
+ const classes = ['fr-card'];
34
+ switch (true) {
35
+ case data.properties.enlargeLink === 'true':
36
+ case data.properties.enlargeLink !== 'false' && contentTitle?.children[0]?.type === 'link':
37
+ classes.push('fr-enlarge-link');
38
+ break;
39
+ }
40
+ if (data.properties.horizontal) classes.push('fr-card--horizontal');
41
+ if (data.properties.download) classes.push('fr-card--download');
35
42
 
36
43
  return {
37
44
  type: 'htmlContainer',
38
45
  tagName: 'div',
39
- classes: ['fr-card', 'fr-enlarge-link', horizontal ? 'fr-card--horizontal' : '', download ? 'fr-card--download' : ''],
46
+ classes: classes,
40
47
  children: [
41
48
  {
42
49
  type: 'htmlContainer',
@@ -30,7 +30,12 @@ class TileContainerDirective extends Node {
30
30
  const description = contentChildren[1];
31
31
  const details = contentChildren[2];
32
32
  const classes = ['fr-tile'];
33
- if ((data.properties.enlargeLink === undefined && title?.children[0]?.type === 'link') || data.properties.enlargeLink) classes.push('fr-enlarge-link');
33
+ switch (true) {
34
+ case data.properties.enlargeLink === 'true':
35
+ case data.properties.enlargeLink !== 'false' && title?.children[0]?.type === 'link':
36
+ classes.push('fr-enlarge-link');
37
+ break;
38
+ }
34
39
  if (data.properties.noBorder) classes.push('fr-tile--no-border');
35
40
  if (data.properties.horizontal) classes.push('fr-tile--horizontal');
36
41
  if (data.properties.download) classes.push('fr-tile--download');