templates/components/metro/icon_generate.partial.twig line 1

Open in your IDE?
  1. {#
  2. icon-metro-single
  3. icon-mcd-*
  4. icon-mck
  5. #}
  6. {%- macro _single_icon(name, color) -%}
  7.     <svg class="modal-list__icon" xmlns="http://www.w3.org/2000/svg" fill="#{{color}}" viewBox="0 0 16 16"><path d="M1.1 12.3H0v1.56h5.66v-1.55H4L5.1 8.4 8 14l2.9-5.6 1.1 3.9h-1.66v1.56H16v-1.55h-1.12L11.15 2 8 8.8 4.83 2 1.1 12.3Z" /></svg>
  8. {%- endmacro -%}
  9. {%- macro _double_icon(name, color1, color2) -%}
  10.     <svg class="modal-list__icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 16"><path d="M3.7 8.83h-.77v1.04h3.94V8.83H5.7l.76-2.59L8.5 9.96l2.03-3.72.76 2.6h-1.16v1.03h3.94V8.83h-.78L10.7 2 8.5 6.51 6.3 2 3.7 8.83Z" fill="#8E8E8E"/><rect x=".5" y="11.02" width="7" height="3" rx="1.5" fill="#{{color1}}"/><rect x="9.5" y="11" width="7" height="3" rx="1.5" fill="#{{color2}}"/></svg>
  11. {%- endmacro -%}
  12. {%- macro _tripple_icon(name, color1, color2, color3) -%}
  13.     <svg class="modal-list__icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 16"><path d="M3.7 8.83h-.77v1.04h3.94V8.83H5.7l.76-2.59L8.5 9.96l2.03-3.72.76 2.6h-1.16v1.03h3.94V8.83h-.78L10.7 2 8.5 6.51 6.3 2 3.7 8.83Z" fill="#8E8E8E"/><rect x=".5" y="11.02" width="4" height="3" rx="1.5" fill="#{{color1}}"/><rect x="6.5" y="11.02" width="4" height="3" rx="1.5" fill="#{{color2}}"/><path d="M12.5 12.5c0-.83.67-1.5 1.5-1.5h1a1.5 1.5 0 0 1 0 3h-1a1.5 1.5 0 0 1-1.5-1.5Z" fill="#{{color3}}"/></svg>
  14. {%- endmacro -%}
  15. {%- macro _mck_icon(name, color) -%}
  16.     <svg class="modal-list__icon" viewBox="0 0 16 16">
  17.         <use style="fill:#{{color}}" class="icon-container--element" xlink:href="#mck"></use>
  18.     </svg>
  19. {%- endmacro -%}
  20. {%- macro _mcd_icon(name, color) -%}
  21.     {% set type = name|last %}
  22.     <svg class="modal-list__icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 16">
  23.     {% if type == 1 %}
  24.         <path fill="#F6A500" d="m21.957 2.792-3.112 10.384c-.206.64-.456.824-1.067.824H.592c-.522 0-.692-.256-.537-.808l3.09-10.384C3.336 2.184 3.572 2 4.197 2h17.2c.523 0 .692.256.56.792Z"/><path fill="#fff" d="M13.105 11.64h3.863l.416-1.175h-1.61V4.352h-2.583v1.16h1.32v4.96h-1.406v1.168Zm-1.249-3.632c0-2.164-1.43-3.656-3.636-3.656H4.993l-.377 1.232h1.193v6.064h2.419c2.199-.008 3.628-1.5 3.628-3.64Zm-1.39 0c0 1.605-.974 2.424-2.277 2.424H7.12V5.56h1.068c1.303 0 2.277.802 2.277 2.448Z"/>{% endif %}
  25.     {% if type == 2 %}
  26.         <path d="m21.96 2.8-3.12 10.38c-.2.64-.45.82-1.06.82H.59c-.52 0-.69-.26-.54-.8l3.1-10.4c.19-.62.42-.8 1.05-.8h17.2c.52 0 .69.26.56.8Z" fill="#E94282"/><path d="m12.6 5.33.86.86a2.67 2.67 0 0 1 1.74-.76c.7 0 1.24.39 1.24 1.05 0 .57-.3.97-1.67 2.33l-1.88 1.85v.99h4.79l.41-1.16h-3.37v-.02l1.33-1.27c1.23-1.17 1.72-1.85 1.72-2.84 0-1.12-.88-2.12-2.5-2.12-1.03-.01-2.02.47-2.66 1.1ZM11.44 8c0-2.17-1.48-3.66-3.79-3.66H4.3l-.4 1.24h1.23v6.07h2.51c2.31-.01 3.79-1.5 3.79-3.65ZM9.97 8c0 1.61-1.01 2.45-2.36 2.45H6.5v-4.9h1.1c1.36 0 2.37.83 2.37 2.45Z" fill="#fff"/>
  27.     {% endif %}
  28.     {% if type == 3 %}
  29.         <path d="M3.75 4.21A.3.3 0 0 1 4.04 4h14.65c.2 0 .34.2.28.38l-2.72 8.41a.3.3 0 0 1-.29.21H1.31a.3.3 0 0 1-.28-.38L3.75 4.2Z" fill="#E95B0C"/><path d="m21.96 2.8-3.12 10.38c-.2.64-.45.82-1.06.82H.59c-.52 0-.69-.26-.54-.8l3.1-10.4c.19-.62.42-.8 1.05-.8h17.2c.52 0 .69.26.56.8Z" fill="#E95B0C"/><path d="M17.1 7.79a2.34 2.34 0 0 0-1.25-.68l1.73-1.72V4.36H12.8V5.6h3.06l-1.8 1.78v.88l.19-.03.26-.03h.27c.46 0 .83.1 1.14.31.3.2.44.47.44.86 0 .36-.13.64-.4.85a1.5 1.5 0 0 1-.98.33 2.26 2.26 0 0 1-1.65-.67l-.11-.1-.9.9.11.1a3.47 3.47 0 0 0 2.57 1c.76 0 1.42-.24 1.94-.7.53-.47.8-1.05.8-1.72a2.18 2.18 0 0 0-.64-1.57ZM10.41 5.39a3.64 3.64 0 0 0-2.74-1.04h-3.1l-.3 1.21h.97v6.08h2.43c1.15 0 2.07-.34 2.74-1.02.67-.7 1-1.56 1-2.61a3.55 3.55 0 0 0-1-2.62ZM10.01 8c0 .84-.23 1.43-.68 1.83-.44.4-1.02.6-1.72.6h-1V5.58h1c.71 0 1.28.2 1.72.62.45.4.68 1 .68 1.82Z" fill="#fff"/>
  30.     {% endif %}
  31.     {% if type == 4 %}
  32.         <path d="M3.75 4.21A.3.3 0 0 1 4.04 4h14.65c.2 0 .34.2.28.38l-2.72 8.41a.3.3 0 0 1-.29.21H1.31a.3.3 0 0 1-.28-.38L3.75 4.2Z" fill="#41B384"/><path d="m21.96 2.8-3.12 10.38c-.2.64-.45.82-1.06.82H.59c-.52 0-.69-.26-.54-.8l3.1-10.4c.19-.62.42-.8 1.05-.8h17.2c.52 0 .69.26.56.8Z" fill="#41B384"/><path d="M10.1 5.4a3.63 3.63 0 0 0-2.74-1.03H4.37l-.3 1.21h.86v6.07h2.42c1.15 0 2.07-.34 2.74-1.02a3.6 3.6 0 0 0 .99-2.6c0-1.06-.32-1.94-.98-2.63ZM9.69 8c0 .85-.24 1.44-.67 1.84-.46.4-1.02.6-1.72.6H6.29V5.6h1c.7 0 1.28.2 1.72.61.44.4.68 1 .68 1.8ZM16.7 8.9V6.8h-1.32v2.1H13.5l1.96-4.53h-1.4l-2.04 4.78v.93h3.36v1.57h1.32v-1.57h.8l.44-1.17H16.7Z" fill="#fff"/>
  33.     {% endif %}
  34.     </svg>
  35. {%- endmacro -%}
  36. {# {% set hasMCD = 0 %} #}
  37. {# {% set hasMCK = 0 %} #}
  38. {% set MCKStation = false %}
  39. {% set basicStations = [] %}
  40. {% for line in data %}
  41.     {% if 'МЦД' in line.name %}
  42.         {# {% set hasMCD = hasMCD + 1 %} #}
  43.     {% elseif 'МЦК' in line.name %}
  44.         {% set MCKStation = {name: line.name, color: line.color} %}
  45.         {# {% set hasMCK = hasMCK + 1 %} #}
  46.     {% else %}
  47.         {% set basicStations = basicStations|merge([{name: line.name, color: line.color}]) %}
  48.     {% endif %}
  49. {% endfor %}
  50. {% set isSingleMetro = '' %}
  51. <span class="modal-list__icons d-flex">
  52.     {% if MCKStation %}
  53.         {% if basicStations|length == 0 %}
  54.             {{ _self._mck_icon(MCKStation.name, MCKStation.color) }}
  55.         {% elseif basicStations|length == 1 %}
  56.             {{ _self._single_icon('Линия ' ~ basicStations[0].name, basicStations[0].color, 'FFA8AF') }}
  57.             {{ _self._mck_icon(MCKStation.name, MCKStation.color) }}
  58.         {% elseif basicStations|length == 2 %}
  59.             {{ _self._double_icon('Линии ' ~ basicStations[0].name ~ ' и ' ~ basicStations[1].name, basicStations[0].color, basicStations[1].color) }}
  60.             {{ _self._mck_icon(MCKStation.name, MCKStation.color) }}
  61.             {# {{ _self._tripple_icon('Линии ' ~ basicStations[0].name ~ ', ' ~ basicStations[1].name ~ ' и ' ~ MCKStation.name, basicStations[0].color, basicStations[1].color, 'FFA8AF') }} #}
  62.         {% endif %}
  63.     {% else %}
  64.         {% if basicStations|length == 1 %}
  65.             {{ _self._single_icon('Линия ' ~ basicStations[0].name, basicStations[0].color) }}
  66.         {% elseif basicStations|length == 2 %}
  67.             {{ _self._double_icon('Линии ' ~ basicStations[0].name ~ ' и ' ~ basicStations[1].name, basicStations[0].color, basicStations[1].color) }}
  68.         {% elseif basicStations|length == 3 %}
  69.             {{ _self._tripple_icon('Линии ' ~ basicStations[0].name ~ ', ' ~ basicStations[1].name ~ ' и ' ~ basicStations[2].name, basicStations[0].color, basicStations[1].color, basicStations[2].color) }}
  70.         {% endif %}
  71.     {% endif %}
  72.     {% for line in data %}
  73.         {% if 'МЦД' in line.name %}
  74.             {{ _self._mcd_icon(line.name, line.color) }}
  75.         {# {% elseif 'МЦК' in line.name %} #}
  76.         {% endif %}
  77.     {% endfor %}
  78. </span>