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" title="{{name}}"><title>{{name}}</title><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" title="{{name}}"><title>{{name}}</title><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" title="{{name}}"><title>{{name}}</title><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" xmlns="http://www.w3.org/2000/svg" fill="#FFA8AF" viewBox="0 0 17 16" title="{{name}}"><title>{{name}}</title>
  17.         <path d="M1.09845 12.8052H0V14.3644H5.65803V12.8052H4L5.09091 8.9L8 14.5L10.9091 8.9L12 12.8052H10.342V14.3644H16V12.8052H14.8808L11.1503 2.5L8 9.3L4.82902 2.5L1.09845 12.8052Z" />
  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" title="{{name}}"><title>{{name}}</title>
  23.     {% if type == 1 %}
  24.         <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="#{{color}}"/>
  25.         <path d="M13.1 11.64h3.87l.41-1.18h-1.6v-6.1h-2.59V5.5h1.32v4.96h-1.4v1.17Zm-1.24-3.63c0-2.17-1.43-3.66-3.64-3.66H4.99l-.37 1.23H5.8v6.07h2.42c2.2-.01 3.63-1.5 3.63-3.64Zm-1.4 0c0 1.6-.97 2.42-2.27 2.42H7.12V5.56H8.2c1.3 0 2.28.8 2.28 2.45Z" fill="#fff"/>
  26.     {% endif %}
  27.     {% if type == 2 %}
  28.         <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="#{{color}}"/>
  29.         <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.13-2.5-2.13-1.03 0-2.02.48-2.66 1.1ZM11.44 8c0-2.17-1.48-3.66-3.79-3.66H4.3l-.4 1.23h1.23v6.08h2.51c2.31-.01 3.79-1.5 3.79-3.65ZM9.97 8c0 1.6-1.01 2.45-2.36 2.45H6.5v-4.9h1.1c1.36 0 2.37.83 2.37 2.45Z" fill="#fff"/>
  30.     {% endif %}
  31.     {% if type == 3 %}
  32.         <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="#{{color}}" />
  33.         <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"/>
  34.     {% endif %}
  35.     {% if type == 4 %}
  36.         <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="#{{color}}" />
  37.         <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"/>
  38.    {% endif %}
  39.     </svg>
  40. {%- endmacro -%}
  41. {# {% set hasMCD = 0 %} #}
  42. {# {% set hasMCK = 0 %} #}
  43. {% set MCKStation = false %}
  44. {% set basicStations = [] %}
  45. {% for line in data %}
  46.     {% if 'МЦД' in line.name %}
  47.         {# {% set hasMCD = hasMCD + 1 %} #}
  48.     {% elseif 'МЦК' in line.name %}
  49.         {% set MCKStation = {name: line.name, color: line.color} %}
  50.         {# {% set hasMCK = hasMCK + 1 %} #}
  51.     {% else %}
  52.         {% set basicStations = basicStations|merge([{name: line.name, color: line.color}]) %}
  53.     {% endif %}
  54. {% endfor %}
  55. {% set isSingleMetro = '' %}
  56. <span class="modal-list__icons d-flex">
  57.     {% if MCKStation %}
  58.         {% if basicStations|length == 0 %}
  59.             {{ _self._mck_icon(MCKStation.name, MCKStation.color) }}
  60.         {% elseif basicStations|length == 1 %}
  61.             {{ _self._double_icon('Линии ' ~ basicStations[0].name ~ ' и ' ~ MCKStation.name, basicStations[0].color, 'FFA8AF') }}
  62.         {% elseif basicStations|length == 2 %}
  63.             {{ _self._tripple_icon('Линии ' ~ basicStations[0].name ~ ', ' ~ basicStations[1].name ~ ' и ' ~ MCKStation.name, basicStations[0].color, basicStations[1].color, 'FFA8AF') }}
  64.         {% endif %}
  65.     {% else %}
  66.         {% if basicStations|length == 1 %}
  67.             {{ _self._single_icon('Линия ' ~ basicStations[0].name, basicStations[0].color) }}
  68.         {% elseif basicStations|length == 2 %}
  69.             {{ _self._double_icon('Линии ' ~ basicStations[0].name ~ ' и ' ~ basicStations[1].name, basicStations[0].color, basicStations[1].color) }}
  70.         {% elseif basicStations|length == 3 %}
  71.             {{ _self._tripple_icon('Линии ' ~ basicStations[0].name ~ ', ' ~ basicStations[1].name ~ ' и ' ~ basicStations[2].name, basicStations[0].color, basicStations[1].color, basicStations[2].color) }}
  72.         {% endif %}
  73.     {% endif %}
  74.     {% for line in data %}
  75.         {% if 'МЦД' in line.name %}
  76.             {{ _self._mcd_icon(line.name, line.color) }}
  77.         {% elseif 'МЦК' in line.name %}
  78.         {% endif %}
  79.     {% endfor %}
  80. </span>