@openeuropa/bcl-badge 0.28.1 → 1.0.2
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/badge.html.twig +29 -28
- package/package.json +5 -2
package/badge.html.twig
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
- label (string) (default: '')
|
|
5
5
|
- background: (string) (default: 'primary')
|
|
6
6
|
- url (string) (default: '')
|
|
7
|
-
- title (string) (default:
|
|
7
|
+
- title (string) (default: '')
|
|
8
8
|
- dismissible (boolean) (default: false)
|
|
9
9
|
- assistive_text (string) (default: '')
|
|
10
10
|
- rounded_pill (boolean) (default: false)
|
|
@@ -16,13 +16,12 @@
|
|
|
16
16
|
{% set _label = label|default('') %}
|
|
17
17
|
{% set _background = background|default('primary') %}
|
|
18
18
|
{% set _url = url|default('') %}
|
|
19
|
-
{% set _title = title|default(
|
|
20
|
-
{% set _dismissible = dismissible
|
|
19
|
+
{% set _title = title|default('') %}
|
|
20
|
+
{% set _dismissible = dismissible ?? false %}
|
|
21
21
|
{% set _assistive_text = assistive_text|default('') %}
|
|
22
22
|
{% set _rounded_pill = rounded_pill|default(false) %}
|
|
23
23
|
{% set _outline = outline|default(false) %}
|
|
24
24
|
{% set _icon_path = icon_path|default('') %}
|
|
25
|
-
|
|
26
25
|
{% set _classes = ['badge'] %}
|
|
27
26
|
|
|
28
27
|
{% if _rounded_pill %}
|
|
@@ -30,47 +29,49 @@
|
|
|
30
29
|
{% endif %}
|
|
31
30
|
|
|
32
31
|
{% if _outline %}
|
|
33
|
-
{% set _classes = _classes|merge([
|
|
32
|
+
{% set _classes = _classes|merge(['badge-outline-' ~ _background]) %}
|
|
34
33
|
{% else %}
|
|
35
|
-
{% set _classes = _classes|merge([
|
|
34
|
+
{% set _classes = _classes|merge(['bg-' ~ _background]) %}
|
|
36
35
|
{% endif %}
|
|
37
36
|
|
|
38
37
|
{% if attributes is empty %}
|
|
39
38
|
{% set attributes = create_attribute() %}
|
|
40
39
|
{% endif %}
|
|
41
40
|
|
|
42
|
-
{%- if
|
|
43
|
-
{% set attributes = attributes.setAttribute('title', _title)
|
|
41
|
+
{%- if _title is not empty -%}
|
|
42
|
+
{% set attributes = attributes.setAttribute('title', _title) %}
|
|
44
43
|
{%- endif -%}
|
|
45
44
|
|
|
46
45
|
{% set attributes = attributes.addClass(_classes) %}
|
|
47
46
|
|
|
48
|
-
{
|
|
49
|
-
<a
|
|
50
|
-
{{ attributes }}
|
|
51
|
-
>
|
|
52
|
-
{%- else -%}
|
|
53
|
-
<span
|
|
54
|
-
{{ attributes }}
|
|
55
|
-
>
|
|
56
|
-
{%- endif -%}
|
|
47
|
+
{% set _label %}
|
|
57
48
|
{%- if _assistive_text is not empty -%}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
<span class="visually-hidden">
|
|
50
|
+
{{- _assistive_text -}}
|
|
51
|
+
</span>
|
|
61
52
|
{%- endif -%}
|
|
62
|
-
|
|
53
|
+
{{- _label -}}
|
|
63
54
|
{%- if _dismissible -%}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
<span class="icon--close" aria-hidden="true">
|
|
56
|
+
{% include '@oe-bcl/bcl-icon/icon.html.twig' with {
|
|
57
|
+
name: "x-lg",
|
|
58
|
+
path: _icon_path,
|
|
59
|
+
} only %}
|
|
60
|
+
</span>
|
|
70
61
|
{%- endif -%}
|
|
62
|
+
{% endset %}
|
|
63
|
+
|
|
71
64
|
{%- if _url is not empty -%}
|
|
72
|
-
|
|
65
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with {
|
|
66
|
+
label: _label,
|
|
67
|
+
path: _url,
|
|
68
|
+
attributes: attributes,
|
|
69
|
+
} only %}
|
|
73
70
|
{%- else -%}
|
|
71
|
+
<span
|
|
72
|
+
{{ attributes }}
|
|
73
|
+
>
|
|
74
|
+
{{- _label -}}
|
|
74
75
|
</span>
|
|
75
76
|
{%- endif -%}
|
|
76
77
|
|
package/package.json
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-badge",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "1.0.2",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@openeuropa/bcl-link": "^1.0.2"
|
|
11
|
+
},
|
|
9
12
|
"description": "OE - BCL badge",
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
@@ -21,5 +24,5 @@
|
|
|
21
24
|
"design-system",
|
|
22
25
|
"twig"
|
|
23
26
|
],
|
|
24
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "54df3dccb26d9f6958862f06103766a0a2d78ca6"
|
|
25
28
|
}
|