templates/_snippets/components/_section.html.twig line 1

Open in your IDE?
  1. {# Style de la section #}
  2. {% set sectionId = ('#'~section(content).id|raw) %}
  3. {% set section = section(content) %}
  4. {% set title = title(content) %}
  5. {% set backgroundGradientDirection = section.backgroundGradientDirection|default('to right') %}
  6. {% set backgroundGradientColor1 = section.backgroundGradientColor1|default('#000') %}
  7. {% set backgroundGradientColor2 = section.backgroundGradientColor2|default('#fff') %}
  8. {% set backgroundGradientColor1Position = section.backgroundGradientColor1Position|default(0) %}
  9. {% set backgroundGradientColor2Position = section.backgroundGradientColor2Position|default(100) %}
  10. {{ sectionId }}{
  11. {{ paddings(section.padding.unit, section.padding.top, section.padding.right, section.padding.bottom, section.padding.left) }}
  12. {% if section.gap.value is not none and section.gap.value != 0 %}grid-gap: {{ (section.gap.value~section.gap.unit)|raw }};{% endif %}
  13. {% if section.minHeight is not none and section.minHeight != 0 %}min-height: {{ (section.minHeight~section.minHeightUnit)|raw }};{% endif %}
  14. }
  15. {% if section.noBackgroundCheckbox == false %}
  16. {% if section.backgroundCheckbox == true %}
  17. {# Je préfère une couleur plutôt qu'une image #}
  18. {{ sectionId }}{
  19. {% if section.backgroundGradientCheckbox == true %}
  20. background: linear-gradient({{ section.backgroundGradientDirection }}, {{ section.backgroundGradientColor1 ~ ' ' ~ section.backgroundGradientColor1Position ~ '%' }}, {{ section.backgroundGradientColor2 ~ ' ' ~ section.backgroundGradientColor2Position ~ '%' }});
  21. {% else %}
  22. {% if section.backgroundColor is not none and section.backgroundColor != '' %}background-color: {{ (section.backgroundColor)|raw }};{% endif %}
  23. {% endif %}
  24. }
  25. {% else %}
  26. {# Je préfère une image plutôt qu'une couleur #}
  27. {{ sectionId }}{
  28. position: relative;
  29. background-size: cover !important;
  30. {% if section.backgroundImage is not none and section.backgroundImage.url != '' %}background: url('{{ (section.backgroundImage.url)|raw }}') no-repeat;{% endif %}
  31. }
  32. {{ sectionId }}::after{
  33. content: "";
  34. {% if section.backgroundFilter is not none and section.backgroundFilter != '' %}background-color: {{ (section.backgroundFilter)|raw }};{% endif %}
  35. {% if section.backgroundFilterOpacity is not none %}opacity: {{ (section.backgroundFilterOpacity)|raw }};{% endif %}
  36. position: absolute;
  37. top: 0;
  38. left: 0;
  39. width: 100%;
  40. height: 100%;
  41. z-index: 1;
  42. }
  43. {{ sectionId }}>*{
  44. z-index: 2;
  45. position: relative;
  46. }
  47. {% endif %}
  48. {% endif %}