Skip to content

Commit

Permalink
Add the placeholder_color param to Figure
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine4livre committed Dec 27, 2022
1 parent b6bb4b9 commit 51f625d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ui/atoms/Figure/Figure.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Custom attributes for the image element.
* @param array $caption_attr
* Custom attributes for the caption element.
* @param string $placeholder_color
*
* @block $caption
* Use this block to customize the image's caption.
Expand All @@ -44,12 +45,13 @@
{% set width = width|default(100) %}
{% set lazy = lazy ?? true %}

{% set placeholder_color = placeholder_color|default('#eee') %}
{%- set placeholder_markup -%}
<svg xmlns="http://www.w3.org/2000/svg"
viewbox="0 0 {{ width }} {{ height }}"
width="{{ width }}"
height="{{ height }}">
<rect x="0" y="0" width="{{ width }}" height="{{ height }}" fill="#eee" />
<rect x="0" y="0" width="{{ width }}" height="{{ height }}" fill="{{ placeholder_color }}" />
</svg>
{%- endset -%}
{% set generic_placeholder = 'data:image/svg+xml,%s'|format(placeholder_markup|url_encode) %}
Expand Down

0 comments on commit 51f625d

Please sign in to comment.