Skip to content

Commit

Permalink
feat(frontend): option to not show hidden prefix for warning text
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Apr 14, 2024
1 parent fe6083c commit 2a66c36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion helpers/frontend/views/frontend-components.njk
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,13 @@
<h2><code>warningText</code></h2>

{{ warningText({
text: "Warning text"
text: "Warning"
}) }}

{{ warningText({
text: "With different icon (and without hidden ‘warning’ prefix)",
icon: "cross",
iconFallbackText: "false"
}) }}

<h2><code>widget</code></h2>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/components/warning-text/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- attributes(opts.attributes) }}>
{{ icon(opts.icon | default("warning")) }}
<strong class="warning-text__text">
<span class="-!-visually-hidden">{{ opts.iconFallbackText | default(__("warning")) }}</span>
{% if not opts.iconFallbackText %}<span class="-!-visually-hidden">{{ opts.iconFallbackText | default(__("warning")) }}</span>{% endif %}
{{ opts.text | safe }}
</strong>
</div>

0 comments on commit 2a66c36

Please sign in to comment.