stack/src/components/icon/icon.twig line 1

Open in your IDE?
  1. {%- set class_name = [
  2.   "icon",
  3.   "d-flex align-items-center justify-content-center",
  4.   props.color in ["primary", "white", "black", "danger"] ? "--colored --" ~ props.color : null,
  5.   props.size in ["xs", "sm", "md", "lg", "xl", "xxl", "xxxl", "4xl"] ? "--" ~ props.size : null,
  6.   props.stroke_off ? "--stroke-off" : null,
  7.   props.extra_class|default(false) ? props.extra_class : null,
  8.   props.name|default(false) ? props.name : null,
  9. ]|join(' ')|trim -%}
  10. {%- set attrs = [
  11.   'class="' ~ class_name ~ '"',
  12. ] -%}
  13. {%- set attrs = attrs|join(' ')|trim -%}
  14. {%- set tag = props.tag in ['div', 'span'] ? props.tag : "span" -%}
  15. {% if props.src %}
  16.   {% set is_svg = props.src|split('.')|last == "svg" %}
  17.   {% set is_from_sulu = 'uploads/media' in props.src %}
  18.   <{{tag}} {{ attrs|raw }}>
  19.     {% if is_svg and not is_from_sulu %}
  20.       {% include props.src %}
  21.     {% else %}
  22.       {% include "@Components/img/img.twig" with {props: {
  23.         src: props.src,
  24.         disable_lazy: true,
  25.       }} %}
  26.     {% endif %}
  27.   </{{tag}}>
  28. {% endif %}