@ilo-org/twig 0.4.1 → 0.5.0

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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @ilo-org/twig@0.4.1 build:lib /home/runner/work/designsystem/designsystem/packages/twig
2
+ > @ilo-org/twig@0.5.0 build:lib /home/runner/work/designsystem/designsystem/packages/twig
3
3
  > node importprefix.js && node importsvgs.js && pnpm output
4
4
 
5
5
  theme prefix added
6
6
 
7
- > @ilo-org/twig@0.4.1 output /home/runner/work/designsystem/designsystem/packages/twig
7
+ > @ilo-org/twig@0.5.0 output /home/runner/work/designsystem/designsystem/packages/twig
8
8
  > node outputtwigs.js
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ilo-org/twig
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e74f529ac: Refactor hero and hero card component. Expose layout and style options more explicitly and remove parameters and classes that refer to specific template names which could change.
8
+ - cc4fe4ba6: In the Callout component, use the Button component so it can take a url and act as a link
9
+
10
+ ### Patch Changes
11
+
12
+ - bb9180a14: In hero, make sure breadcrumb is not null and not empty or it could render unintentionally
13
+ - Updated dependencies [5df0bb1a9]
14
+ - Updated dependencies [51b4be31a]
15
+ - Updated dependencies [6a7dbe609]
16
+ - Updated dependencies [b498c19c4]
17
+ - @ilo-org/icons@0.2.0
18
+ - @ilo-org/themes@0.1.16
19
+ - @ilo-org/styles@0.4.0
20
+
3
21
  ## 0.4.1
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/twig",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Twig components for the ILO's Design System",
6
6
  "main": "",
@@ -24,9 +24,9 @@
24
24
  "video.js": "^7.21.2",
25
25
  "@ilo-org/brand-assets": "0.1.0",
26
26
  "@ilo-org/fonts": "0.1.0",
27
- "@ilo-org/icons": "0.1.17",
28
- "@ilo-org/styles": "0.3.5",
29
- "@ilo-org/themes": "0.1.15",
27
+ "@ilo-org/icons": "0.2.0",
28
+ "@ilo-org/styles": "0.4.0",
29
+ "@ilo-org/themes": "0.1.16",
30
30
  "@ilo-org/utils": "0.0.11"
31
31
  },
32
32
  "devDependencies": {
@@ -16,14 +16,19 @@
16
16
  {% endif %}
17
17
  </div>
18
18
  {{ content }}
19
- {% if buttonLabel %}
19
+ {% if button %}
20
20
  <div class="{{prefix}}--callout--footer">
21
- <button
22
- class="{{prefix}}--button {{prefix}}--button--small {{prefix}}--button--secondary"
23
- type="button"
24
- >
25
- <span class="button__label">{{ buttonLabel }}</span>
26
- </button>
21
+ {% include '@components/button/button.twig' with {
22
+ label: button.label,
23
+ url: button.url,
24
+ target: button.target,
25
+ icon: button.icon,
26
+ className: button.className,
27
+ icon: button.icon,
28
+ iconPosition: button.iconPosition,
29
+ size: "small",
30
+ type: "secondary",
31
+ } %}
27
32
  </div>
28
33
  {% endif %}
29
34
  </div>
@@ -3,12 +3,17 @@ callout:
3
3
  label: Callout
4
4
  description: A callout alert section with a few different types
5
5
  fields:
6
- buttonLabel:
7
- type: string
6
+ button:
7
+ type: object
8
8
  label: Button Label
9
- description: The label for the optional button
10
- preview: "Optional Button Label"
9
+ description: Fields to pass to the button if there is one
11
10
  required: false
11
+ preview:
12
+ label: "Button"
13
+ url: "https://www.ilo.org"
14
+ target: "_blank"
15
+ icon: false
16
+ className: "optionalclass"
12
17
  content:
13
18
  type: text
14
19
  label: Content
@@ -61,9 +61,9 @@ footer:
61
61
  url: "http://www.google.com"
62
62
  - type: "twitter"
63
63
  url: "http://www.google.com"
64
- - type: "twitter"
64
+ - type: "tiktok"
65
65
  url: "http://www.google.com"
66
- - type: "instagram"
66
+ - type: "flickr"
67
67
  url: "http://www.google.com"
68
68
  subscribe:
69
69
  type: object
@@ -1,35 +1,52 @@
1
1
  {#
2
- HERO COMPONENT
2
+ Temp COMPONENT
3
3
  #}
4
- <div class="{{prefix}}--hero {{prefix}}--hero--{{theme}} {{prefix}}--hero--{{types}} {% if image %}{{prefix}}--hero--image{% endif %}">
5
- {% if breadcrumb is defined %}
6
- {% include "@components/breadcrumb/breadcrumb.twig" with {
7
- home: breadcrumb.home,
8
- links: breadcrumb.links,
4
+ <div class="hero hero__card-justify__{{ justify }} hero__poster-size__{{ postersize }} hero__card-size__{{ cardsize }} hero__card-align__{{ align }}">
5
+ <figure class="hero--figure">
6
+ {% block hero_image %}
7
+ {% if image %}
8
+ <picture>
9
+ {% for img in image.url|reverse %}
10
+ {% if loop.last == false %}
11
+ <source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
12
+ {% endif %}
13
+ {% endfor %}
14
+ <img class="{{prefix}}--card--image" src="{{image.url|reverse|last.src}}" alt="{{image.alt}}" {% if image.loading %} loading="{{ image.loading }}"{% endif %}>
15
+ </picture>
16
+ {% endif %}
17
+ {% endblock %}
18
+ </figure>
19
+ {% if breadcrumb %}
20
+ <div class="hero--breadcrumbs">
21
+ <div class="hero--breadcrumbs--wrapper">
22
+ {% include "@components/breadcrumb/breadcrumb.twig" with {
23
+ home: breadcrumb.home,
24
+ links: breadcrumb.links,
25
+ prefix: prefix,
26
+ } only %}
27
+ </div>
28
+ </div>
29
+ {% endif %}
30
+ <div class="hero--card">
31
+ {% include "@components/herocard/herocard.twig" with {
32
+ url: herocard.url,
33
+ eyebrow: herocard.eyebrow,
34
+ cornercut: herocard.cornercut,
35
+ datecopy: herocard.datecopy,
36
+ intro: herocard.intro,
9
37
  prefix: prefix,
38
+ socials: herocard.socials,
39
+ theme: herocard.theme,
40
+ background: herocard.background,
41
+ title: herocard.title,
10
42
  } only %}
11
- {% endif %}
12
- {% block hero_image %}
13
- {% if not image %}
14
- {% else %}
15
- {% include "@components/image/image.twig" with {
16
- alt: image.alt,
17
- prefix: prefix,
18
- url: image.url,
19
- ishero: "true"
20
- } only %}
21
- {% endif %}
22
- {% endblock %}
23
- {% include "@components/herocard/herocard.twig" with {
24
- alignment: herocard.alignment,
25
- eyebrow: herocard.eyebrow,
26
- datecopy: herocard.datecopy,
27
- hasbackground: hasbackground,
28
- intro: herocard.intro,
29
- prefix: prefix,
30
- socials: herocard.socials,
31
- theme: theme,
32
- title: herocard.title,
33
- types: types
34
- } only %}
35
- </div>
43
+ </div>
44
+ <div class="hero--caption">
45
+ {% if not caption %}
46
+ {% else %}
47
+ <div class="hero--caption--wrapper">
48
+ {% include '@components/tooltip/tooltip.twig' with caption %}
49
+ </div>
50
+ {% endif %}
51
+ </div>
52
+ </div>
@@ -1,10 +1,23 @@
1
1
  hero:
2
2
  use: "@components/hero/hero.twig"
3
3
  label: Hero
4
- description: The Hero presents an image banner.
4
+ description: The Hero is an attention-grabbing section of a web page designed to engage users and create a memorable first impression.
5
5
  fields:
6
+ image:
7
+ label: Image
8
+ type: object
9
+ description: The image to display in the hero. The image will be cropped to fit the hero's aspect ratio.
10
+ preview:
11
+ alt: Lorem ipsum
12
+ loading: lazy
13
+ url:
14
+ - breakpoint: 0
15
+ src: "/images/hero.jpg"
16
+ - breakpoint: 768
17
+ src: "/images/hero.jpg"
6
18
  breadcrumb:
7
- label: Implementation of Breadcrumb component. See Breadcrumb for more details
19
+ label: Bread crumbs
20
+ description: The breadcrumb navigation to display in the hero.
8
21
  type: object
9
22
  preview:
10
23
  home:
@@ -21,72 +34,123 @@ hero:
21
34
  url: "/linkfour"
22
35
  - label: "Link Five"
23
36
  url: "/linkfive"
24
- image:
25
- label: Implementation of Image component. See Image for more details
26
- type: object
27
- preview:
28
- alt: Lorem ipsum
29
- url:
30
- - breakpoint: 0
31
- src: "/images/hero.jpg"
32
- - breakpoint: 768
33
- src: "/images/hero.jpg"
34
37
  herocard:
35
- label: Part of the hero that displays text on top of image (or if no image on a background color). There are light and dark versions and all text parts are optional.
38
+ label: Hero Card
36
39
  type: object
40
+ description: The hero card to display in the hero. See docs on the Hero Card component for more information about the fields.
37
41
  preview:
38
- alignment: left
39
- datecopy: 11 February 2022
40
- eyebrow: Eyebrow
41
- intro: "Brief intro text - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
42
+ title: "Child labour"
43
+ theme: "dark"
44
+ background: "solid"
45
+ cornercut: "true"
46
+ eyebrow: ILO Topics
42
47
  socials:
43
48
  - label: "Facebook"
44
49
  url: "https://www.facebook.com/ilo.org"
45
50
  icon: "facebook"
51
+ - label: "Twitter"
52
+ url: "https://www.twitter.com/ilo.org"
53
+ icon: "twitter"
46
54
  - label: "Linkedin"
47
55
  url: "https://www.linkedin.com/company/international-labour-organization-ilo"
48
56
  icon: "linkedin"
49
- title: "This is an left aligned article headline that is more than two lines long"
57
+ caption:
58
+ label: Caption
59
+ type: object
60
+ description: The credit and caption information about the image. Appears as a tooltip.
61
+ preview:
62
+ label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
63
+ icon: "true"
64
+ theme: "dark"
65
+ settings:
66
+ justify:
67
+ label: Justify
68
+ description: Sets the horizontal alignment of the hero card. `start` is on the left in LTR layouts and on the right in RTL layouts.
69
+ type: select
70
+ options:
71
+ start: start
72
+ offset: offset
73
+ center: center
74
+ preview: "start"
75
+ align:
76
+ label: Align
77
+ description: Sets the vertical alignment of the hero card.
78
+ type: select
79
+ options:
80
+ baseline: baseline
81
+ center: center
82
+ bottom: bottom
83
+ preview: "baseline"
84
+ postersize:
85
+ label: Poster Size
86
+ description: Sets the size of the image poster.
87
+ type: select
88
+ options:
89
+ small: small
90
+ medium: medium
91
+ large: large
92
+ xlarge: xlarge
93
+ preview: large
94
+ cardsize:
95
+ label: Card Size
96
+ description: Sets the width of the hero card.
97
+ type: select
98
+ options:
99
+ small: small
100
+ medium: medium
101
+ large: large
102
+ xlarge: xlarge
103
+ xxlarge: xxlarge
104
+ preview: small
50
105
  variants:
51
106
  default:
52
107
  label: Default
108
+ homepage:
109
+ label: Homepage
110
+ description: The hero variant for the homepage.
111
+ settings:
112
+ align: "center"
113
+ justify: "start"
114
+ postersize: "large"
115
+ cardsize: "medium"
116
+ fields:
117
+ breadcrumb: null
118
+ herocard:
119
+ title: "ILO welcomes G7 call to make a just transition to a green economy happen"
120
+ url: "https://www.ilo.org"
121
+ theme: "dark"
122
+ background: "semi-transparent"
123
+ cornercut: false
124
+ eyebrow: UN General Assembly
53
125
  article:
54
126
  label: Article
55
- description: article settings
56
- fields:
57
- image: ""
58
127
  settings:
59
- theme: light
60
- types: article
61
- settings:
62
- theme:
63
- type: select
64
- label: Theme
65
- description: The theme type for the hero
66
- required: false
67
- preview: "dark"
68
- options:
69
- dark: Dark
70
- light: Light
71
- hasbackground:
72
- type: select
73
- label: Has Background
74
- description: does the hero card have a background? (Defaults to true, only applied to Home Hero)
75
- options:
76
- true: true
77
- false: "false"
78
- preview: true
79
- types:
80
- type: select
81
- label: Types
82
- description: The type of hero
83
- required: false
84
- preview: "publication"
85
- options:
86
- home: Home
87
- publication: Publication
88
- graphic: Graphic
89
- project: Project
90
- article: Article
91
- portal: Portal
128
+ align: "bottom"
129
+ justify: "center"
130
+ postersize: "xlarge"
131
+ cardsize: "large"
132
+ fields:
133
+ breadcrumb: null
134
+ herocard:
135
+ title: "When a woman becomes a boss in a man's world"
136
+ datecopy: "11 February 2021"
137
+ theme: "light"
138
+ background: "solid"
139
+ cornercut: "true"
140
+ eyebrow: Women in management
141
+ socials:
142
+ - label: "Facebook"
143
+ url: "https://www.facebook.com/ilo.org"
144
+ icon: "facebook"
145
+ - label: "Twitter"
146
+ url: "https://www.twitter.com/ilo.org"
147
+ icon: "twitter"
148
+ - label: "Linkedin"
149
+ url: "https://www.linkedin.com/company/international-labour-organization-ilo"
150
+ icon: "linkedin"
151
+ caption:
152
+ label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
153
+ icon: "true"
154
+ theme: "dark"
92
155
  visibility: storybook
156
+
@@ -1,12 +1,18 @@
1
1
  {#
2
2
  HEROCARD COMPONENT
3
3
  #}
4
- <div class="{{prefix}}--hero-card {{prefix}}--hero-card--{{alignment}} {{prefix}}--hero-card--{{theme}} {{prefix}}--hero-card--{{types}}{% if not hasbackground or hasbackground == 'false' %} {{prefix}}--hero-card--nobackground{% endif %}">
4
+ <div class="{{prefix}}--hero-card {{prefix}}--hero-card__theme__{{ theme }} {{prefix}}--hero-card__background__{{ background }} {% if cornercut == "true" %} {{prefix}}--hero-card__cornercut {% endif %}">
5
5
  {% if eyebrow %}
6
6
  <p class="{{ prefix }}--hero-card--eyebrow">{{ eyebrow }}</p>
7
7
  {% endif %}
8
8
  {% if title %}
9
- <h2 class="{{ prefix }}--hero-card--title">{{ title }}</h2>
9
+ {% if url %}
10
+ <a href={{ url }} class="{{ prefix }}--hero-card--title-link">
11
+ <h1 class="{{ prefix }}--hero-card--title">{{ title }}</h1>
12
+ </a>
13
+ {% else %}
14
+ <h1 class="{{ prefix }}--hero-card--title">{{ title }}</h2>
15
+ {% endif %}
10
16
  {% endif %}
11
17
  {% if datecopy %}
12
18
  <p class="{{ prefix }}--hero-card--datecopy">{{ datecopy }}</p>
@@ -14,7 +20,6 @@
14
20
  {% if intro %}
15
21
  <p class="{{ prefix }}--hero-card--intro">{{ intro }}</p>
16
22
  {% endif %}
17
-
18
23
  <ul class="{{ prefix }}--hero-card--list">
19
24
  {% for item in socials %}
20
25
  <li class="{{ prefix }}--hero-card--list--item">
@@ -1,9 +1,40 @@
1
1
  herocard:
2
2
  use: "@components/herocard/herocard.twig"
3
3
  label: Hero Card
4
- description: The Hero card, a subcomponent of the hero
4
+ description: The Hero Card includes the title, intro, date, and social links for the hero
5
5
  id: herocard
6
+ settings:
7
+ theme:
8
+ type: select
9
+ label: Theme
10
+ description: The theme of the hero card.
11
+ options:
12
+ light: light
13
+ dark: dark
14
+ preview: "dark"
15
+ background:
16
+ type: select
17
+ label: Background
18
+ description: Should the background be solid, semi-transparent or transparent
19
+ options:
20
+ solid: solid
21
+ semi-transparent: semi-transparent
22
+ transparent: transparent
23
+ preview: "solid"
24
+ cornercut:
25
+ type: select
26
+ label: Cornercut
27
+ description: Whether the card show have its right or left corner cut
28
+ options:
29
+ false: false
30
+ true: "true"
31
+ preview: "true"
6
32
  fields:
33
+ url:
34
+ type: string
35
+ label: URL
36
+ description: Optional URL for the hero card. If provided, the title will be a link.
37
+ preview: null
7
38
  datecopy:
8
39
  type: string
9
40
  label: Date copy
@@ -13,12 +44,12 @@ herocard:
13
44
  type: string
14
45
  label: Eyebrow
15
46
  description: Copy for the eyebrow of the card
16
- preview: "Eyebrow"
47
+ preview: "Gender equality"
17
48
  intro:
18
49
  type: string
19
50
  label: Intro
20
51
  description: Intro text for the hero
21
- preview: "Brief intro text - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
52
+ preview: "Over the last three decades, global supply chains have been a key entry point for women to enter the formal workforce."
22
53
  socials:
23
54
  type: object
24
55
  label: Social links
@@ -34,23 +65,5 @@ herocard:
34
65
  type: string
35
66
  label: Title
36
67
  description: This is the title for the hero card
37
- preview: "This is an centered aligned article headline that is more than two lines long"
38
- settings:
39
- alignment:
40
- type: select
41
- label: Alignment
42
- description: alignment for card
43
- options:
44
- left: "left"
45
- center: "center"
46
- right: "right"
47
- preview: "center"
48
- hasbackground:
49
- type: select
50
- label: Has Background
51
- description: does the hero card have a background? (Defaults to true, only applied to Home Hero)
52
- options:
53
- true: true
54
- false: "false"
55
- preview: true
68
+ preview: "How to achieve gender equality in global garment supply chains"
56
69
  visibility: storybook
@@ -2,7 +2,7 @@
2
2
  TOOLTIP COMPONENT
3
3
  #}
4
4
  <div
5
- class="{{prefix}}--tooltip--wrapper{% if icon and icon != 'false' %} has-icon{% endif %}" role="status" aria-live="polite" aria-relevant="additions" data-loadcomponent="Tooltip" data-prefix="{{prefix}}"
5
+ class="{{prefix}}--tooltip--wrapper{% if icon and icon != 'false' %} has-icon{% endif %} {{prefix}}--tooltip--wrapper--{{theme}}" role="status" aria-live="polite" aria-relevant="additions" data-loadcomponent="Tooltip" data-prefix="{{prefix}}"
6
6
  >
7
7
  {% if not icon or icon == 'false' %}
8
8
  {{ children|raw }}