templates/components/Spacer/index.html.twig line 1

Open in your IDE?
  1. {% set spacerClassName = random() %}
  2. {% set className = className ?? '' %}
  3. {% set containerId = containerId ?? null %}
  4. {% set height = height ?? null %}
  5. {% set mediumHeight = mediumHeight ?? null %}
  6. {% set largeHeight = largeHeight ?? null %}
  7. {% set xlargeHeight = xlargeHeight ?? null %}
  8. {% set width = width ?? null %}
  9. {% set mediumWidth = mediumWidth ?? null %}
  10. {% set largeWidth = largeWidth ?? null %}
  11. {% set xlargeWidth = xlargeWidth ?? null %}
  12. <div class="spacer-{{ spacerClassName }} {{ className }}" {% if containerId != null %}id="{{ containerId }}"{% endif %}></div>
  13. <style>
  14.     .spacer-{{ spacerClassName }} {
  15.       {% if height %}
  16.         height: {{ height / 16 }}rem;
  17.       {% endif %}
  18.       {% if width %}
  19.         flex: 0 0 {{ width / 16 }}rem;
  20.         width: {{ width / 16 }}rem;
  21.       {% endif %}
  22.     }
  23.     @media screen and (min-width: 640px) {
  24.       .spacer-{{ spacerClassName }} {
  25.         {% if mediumHeight is not null %}
  26.           height: {{ mediumHeight / 16 }}rem;
  27.         {% endif %}
  28.         {% if mediumWidth is not null %}
  29.           flex: 0 0 {{ mediumWidth / 16 }}rem;
  30.           width: {{ mediumWidth / 16 }}rem;
  31.         {% endif %}
  32.       }
  33.     }
  34.     @media screen and (min-width: 1024px) {
  35.       .spacer-{{ spacerClassName }} {
  36.         {% if largeHeight is not null %}
  37.           height: {{ largeHeight / 16 }}rem;
  38.         {% endif %}
  39.         {% if largeWidth is not null %}
  40.           flex: 0 0 {{ largeWidth / 16 }}rem;
  41.           width: {{ largeWidth / 16 }}rem;
  42.         {% endif %}
  43.       }
  44.     }
  45.     @media screen and (min-width: 1200px) {
  46.       .spacer-{{ spacerClassName }} {
  47.         {% if xlargeHeight is not null %}
  48.           height: {{ xlargeHeight / 16 }}rem;
  49.         {% endif %}
  50.         {% if xlargeWidth is not null %}
  51.           flex: 0 0 {{ xlargeWidth / 16 }}rem;
  52.           width: {{ xlargeWidth / 16 }}rem;
  53.         {% endif %}
  54.       }
  55.     }
  56. </style>