Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 39 additions & 43 deletions src/components/bcl-accordion/accordion.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% apply spaceless %}

{#
Parameters:
- title (string) (default: '')
Expand All @@ -22,7 +20,7 @@
- attributes (drupal attrs)
#}

{% set _title = title|default('') %}
{%- set _title = title|default('') %}
{% set _title_tag = title_tag|default('h2') %}
{% set _title_link = title_link|default({}) %}
{% set _title_attributes = title_attributes ?: create_attribute() %}
Expand All @@ -34,16 +32,16 @@
{% set _open_item_id = open_item_id|default(0) %}
{% set _classes = ['accordion'] %}
{% if _flush %}
{% set _classes = _classes|merge(['accordion-flush']) %}
{%- set _classes = _classes|merge(['accordion-flush']) %}
{% endif %}

{% if attributes is empty %}
{% set attributes = create_attribute() %}
{%- if attributes is empty %}
{%- set attributes = create_attribute() %}
{% endif %}

{% set attributes = attributes.addClass(_classes).setAttribute('id', 'accordion-' ~ _id) %}
{%- set attributes = attributes.addClass(_classes).setAttribute('id', 'accordion-' ~ _id) %}

{% if _items is not empty %}
{%- if _items is not empty -%}
<div
{{ attributes }}
>
Expand All @@ -57,70 +55,70 @@
{%- endif -%}

{% if _items|length > 1 and (_expand_button is not empty or _collapse_button is not empty) %}
{% set wrapper_attributes = create_attribute().addClass(['d-flex', 'justify-content-end', 'gap-3', 'mb-3']) %}
{%- set wrapper_attributes = create_attribute().addClass(['d-flex', 'justify-content-end', 'gap-3', 'mb-3']) -%}
<div
{{ wrapper_attributes }}
>
{% if _expand_button is not empty %}
{% if _expand_button.attributes is empty %}
{% set _expand_button = _expand_button|merge({
{%- if _expand_button is not empty %}
{%- if _expand_button.attributes is empty %}
{%- set _expand_button = _expand_button|merge({
attributes: create_attribute()
})
%}
{% endif %}
{% include '@oe-bcl/bcl-button/button.html.twig' with _expand_button|merge({
{%- endif %}
{%- include '@oe-bcl/bcl-button/button.html.twig' with _expand_button|merge({
attributes: _expand_button.attributes
.setAttribute('data-target', 'accordion-' ~ _id)
.setAttribute('data-action', 'expand')
}) only %}
{% endif %}
{% if _collapse_button is not empty %}
{% if _collapse_button.attributes is empty %}
{% set _collapse_button = _collapse_button|merge({
{%- endif %}
{%- if _collapse_button is not empty %}
{%- if _collapse_button.attributes is empty %}
{%- set _collapse_button = _collapse_button|merge({
attributes: create_attribute()
})
%}
{% endif %}
{% include '@oe-bcl/bcl-button/button.html.twig' with _collapse_button|merge({
{%- endif %}
{%- include '@oe-bcl/bcl-button/button.html.twig' with _collapse_button|merge({
attributes: _collapse_button.attributes
.setAttribute('data-target', 'accordion-' ~ _id)
.setAttribute('data-action', 'collapse')
}) only %}
{% endif %}
{%- endif -%}
</div>
{% endif %}
{%- endif -%}
<div class="accordion-items-wrapper">
{% for _item in _items %}
{% set _open_item = _open_item_id == loop.index %}
{% set _button_classes = ['accordion-button'] %}
{% if not _open_item %}
{% set _button_classes = _button_classes|merge(['collapsed']) %}
{% endif %}
{%- for _item in _items %}
{%- set _open_item = _open_item_id == loop.index %}
{%- set _button_classes = ['accordion-button'] %}
{%- if not _open_item %}
{%- set _button_classes = _button_classes|merge(['collapsed']) %}
{%- endif -%}
<div class="accordion-item">
{%- set _item_title_tag = _item.title_tag|default('h2') %}
{%- set _item_title_tag = _item.title_tag|default('h2') -%}
<{{ _item_title_tag }}
class="accordion-header"
id="heading-{{ _id }}-{{ loop.index }}"
>
{% set button_attributes = create_attribute()
{%- set button_attributes = create_attribute()
.addClass(_button_classes)
.setAttribute('data-bs-toggle', 'collapse')
.setAttribute('autocomplete', 'off')
.setAttribute('data-bs-target', '#collapse-' ~ _id ~ '-' ~ loop.index)
.setAttribute('aria-controls', 'collapse-' ~ _id ~ '-' ~ loop.index)
.setAttribute('aria-expanded', open_item ? 'true' : 'false')
%}
{% set item_title %}
{%- set item_title -%}
<span>
{{- _item.title -}}
</span>
{% endset %}
{% include '@oe-bcl/bcl-button/button.html.twig' with {
{%- endset %}
{%- include '@oe-bcl/bcl-button/button.html.twig' with {
label: item_title,
clean_class: true,
attributes: button_attributes
} only %}
</{{ _item_title_tag }}>
} only -%}
</{{ _item_title_tag }}>{# -#}
<div
id="collapse-{{ _id }}-{{ loop.index }}"
class="accordion-collapse collapse{{ _open_item ? ' show' }}"
Expand All @@ -129,16 +127,14 @@
{% if not _item.stay_open and _expand_button is empty %}
data-bs-parent="#accordion-{{ _id }}"
{% endif %}
>
>{# -#}
<div class="accordion-body">
{%- set _content = _item.content|default('') %}
{%- block content _content -%}
</div>
</div>
</div>{# -#}
</div>{# -#}
</div>
{% endfor %}
</div>
{%- endfor -%}
</div>{# -#}
</div>
{% endif %}

{% endapply %}
{%- endif -%}
41 changes: 19 additions & 22 deletions src/components/bcl-alert/alert.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% apply spaceless %}

{# Parameters:
- message (string) (default: '')
- heading (string) (default: '')
Expand All @@ -11,15 +9,15 @@
- attributes (drupal attrs)
#}

{% set _message = message|default('') %}
{%- set _message = message|default('') %}
{% set _heading = heading|default('') %}
{% set _variant = variant|default('primary') %}
{% set _dismissible = dismissible ?? true %}
{% set _animated_dismiss = animated_dismiss ?? true %}
{% set _icon_path = icon_path|default('') %}
{% set _icon_name = icon_name|default('') %}

{% set _classes = ['alert', 'alert-' ~ _variant|e('html_attr'), 'd-flex', 'align-items-center'] %}
{%- set _classes = ['alert', 'alert-' ~ _variant|e('html_attr'), 'd-flex', 'align-items-center'] %}
{% set _icon_names = {
primary: "info-circle-fill",
secondary: "info-circle-fill",
Expand All @@ -32,52 +30,51 @@
}
%}

{% if _dismissible %}
{% set _classes = _classes|merge(['alert-dismissible']) %}
{%- if _dismissible %}
{%- set _classes = _classes|merge(['alert-dismissible']) %}
{% endif %}
{% if _animated_dismiss %}
{% set _classes = _classes|merge(['fade', 'show']) %}
{%- set _classes = _classes|merge(['fade', 'show']) %}
{% endif %}

{% set _classes = _classes|merge(['text-dark']) %}
{%- set _classes = _classes|merge(['text-dark']) %}

{% set _icon_classes = ['flex-shrink-0 me-3 mt-1 align-self-start' ] %}
{%- set _icon_classes = ['flex-shrink-0 me-3 mt-1 align-self-start' ] %}

{% if _variant != 'light' %}
{% set _icon_classes = _icon_classes|merge(['text-' ~ _variant]) %}
{%- if _variant != 'light' %}
{%- set _icon_classes = _icon_classes|merge(['text-' ~ _variant]) %}
{% endif %}

{% if attributes is empty %}
{% set attributes = create_attribute() %}
{%- if attributes is empty %}
{%- set attributes = create_attribute() %}
{% endif %}

{% set attributes = attributes.addClass(_classes).setAttribute('role', 'alert') %}
{%- set attributes = attributes.addClass(_classes).setAttribute('role', 'alert') -%}

<div {{ attributes }}>
{% if _icon_path is not empty %}
{% include '@oe-bcl/bcl-icon/icon.html.twig' with {
{%- if _icon_path is not empty %}
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
name: _icon_name ?: _icon_names[_variant],
size: 's',
path: _icon_path,
attributes: create_attribute().addClass(_icon_classes),
} only %}
{% endif %}
{% endif -%}
<div class="alert-content flex-grow-1">
{%- if _heading is not empty -%}
<div class="alert-heading h4">{{ _heading }}</div>
{%- endif -%}
{%- if _message is not empty -%}
{{- _message -}}
{{- _message|spaceless -}}
{%- endif -%}
</div>
{%- if _dismissible -%}
<button
type="button"
class="btn-close"
data-bs-dismiss="alert"
aria-label="Close">
</button>
aria-label="Close"
></button>
{%- endif -%}
</div>

{% endapply %}
{#--#}
26 changes: 11 additions & 15 deletions src/components/bcl-badge/badge.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% apply spaceless %}

{# Parameters:
- label (string) (default: '')
- background: (string) (default: 'primary')
Expand All @@ -13,7 +11,7 @@
- attributes (drupal attrs)
#}

{% set _label = label|default('') %}
{%- set _label = label|default('') %}
{% set _background = background|default('primary') %}
{% set _url = url|default('') %}
{% set _title = title|default('') %}
Expand All @@ -24,18 +22,18 @@
{% set _icon_path = icon_path|default('') %}
{% set _classes = ['badge'] %}

{% if _rounded_pill %}
{% set _classes = _classes|merge(['rounded-pill']) %}
{%- if _rounded_pill %}
{%- set _classes = _classes|merge(['rounded-pill']) %}
{% endif %}

{% if _outline %}
{% set _classes = _classes|merge(['badge-outline-' ~ _background]) %}
{%- if _outline %}
{%- set _classes = _classes|merge(['badge-outline-' ~ _background]) %}
{% else %}
{% set _classes = _classes|merge(['text-bg-' ~ _background]) %}
{%- set _classes = _classes|merge(['text-bg-' ~ _background]) %}
{% endif %}

{% if attributes is empty %}
{% set attributes = create_attribute() %}
{%- if attributes is empty %}
{%- set attributes = create_attribute() %}
{% endif %}

{%- if _title is not empty -%}
Expand All @@ -44,7 +42,7 @@

{% set attributes = attributes.addClass(_classes) %}

{% set _label %}
{%- set _label %}
{%- if _assistive_text is not empty -%}
<span class="visually-hidden">
{{- _assistive_text -}}
Expand All @@ -53,11 +51,11 @@
{{- _label -}}
{%- if _dismissible -%}
<span class="icon--close" aria-hidden="true">
{% include '@oe-bcl/bcl-icon/icon.html.twig' with {
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
name: "x-circle-fill",
size: "xs",
path: _icon_path,
} only %}
} only -%}
</span>
{%- endif -%}
{% endset %}
Expand All @@ -75,5 +73,3 @@
{{- _label -}}
</span>
{%- endif -%}

{% endapply %}
33 changes: 15 additions & 18 deletions src/components/bcl-blockquote/blockquote.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% apply spaceless %}

{# Parameters:
- title (string) (default: '')
- title_tag (string) (default: 'h2')
Expand All @@ -13,7 +11,7 @@
- attributes (drupal attrs)
#}

{% set _title = title|default('') %}
{%- set _title = title|default('') %}
{% set _title_tag = title_tag|default('h2') %}
{% set _title_link = title_link|default({}) %}
{% set _title_attributes = title_attributes ?: create_attribute() %}
Expand All @@ -22,7 +20,7 @@
{% set _cite = cite|default('') %}
{% set _alignment = alignment|default('left') %}

{% set _classes = [
{%- set _classes = [
'text-' ~ _alignment,
"bg-lighter",
"p-2",
Expand All @@ -31,19 +29,19 @@
"border-secondary"
] %}

{% if _alignment == "center" %}
{% set _classes = _classes|merge(["border-top"]) %}
{%- if _alignment == "center" %}
{%- set _classes = _classes|merge(["border-top"]) %}
{% elseif _alignment == "end" %}
{% set _classes = _classes|merge(["border-end"]) %}
{%- set _classes = _classes|merge(["border-end"]) %}
{% else %}
{% set _classes = _classes|merge(["border-start"]) %}
{%- set _classes = _classes|merge(["border-start"]) %}
{% endif %}

{% if attributes is empty %}
{% set attributes = create_attribute() %}
{%- if attributes is empty %}
{%- set attributes = create_attribute() %}
{% endif %}

{% set attributes = attributes.addClass(_classes) %}
{%- set attributes = attributes.addClass(_classes) %}

{%- if _title is not empty -%}
{% include '@oe-bcl/bcl-heading/heading.html.twig' with {
Expand All @@ -56,18 +54,17 @@

<figure
{{ attributes }}
>
<blockquote class="blockquote mb-2">
<p>{{- _quote -}}</p>
>{# -#}
<blockquote class="blockquote mb-2">{# -#}
<p>{{- _quote -}}</p>{# -#}
</blockquote>
{% if _attribution is not empty %}
{%- if _attribution is not empty -%}
<figcaption class="blockquote-footer m-0">
{{- _attribution -}}
{% if _cite is not empty -%}
<cite title="{{ _cite }}">{{- _cite -}}</cite>
{%- endif -%}
</figcaption>
{% endif %}
{%- endif -%}
</figure>

{% endapply %}
{#--#}
Loading
Loading