gallery.html.twig 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {% set styling %}
  2. .lightbox-gallery {
  3. max-width: 1200px;
  4. margin: 0 auto;
  5. padding: 0 20px;
  6. }
  7. .lightbox-gallery .lightbox-gallery__columns {
  8. display: flex;
  9. flex-wrap: wrap;
  10. margin: 0 -10px;
  11. }
  12. .lightbox-gallery .lightbox-gallery__column {
  13. width: 50%;
  14. padding: 0 10px;
  15. margin-bottom: 20px;
  16. }
  17. .lightbox-gallery img {
  18. display: block;
  19. border-radius: 5px;
  20. transition: all .2s ease-in-out;
  21. }
  22. .lightbox-gallery img:hover {
  23. filter: brightness(60%);
  24. transform: scale(1.05);
  25. }
  26. @media only screen and (min-width: 600px) {
  27. .lightbox-gallery .lightbox-gallery__column {
  28. width: calc(100% / 3);
  29. }
  30. }
  31. @media only screen and (min-width: 1000px) {
  32. .lightbox-gallery .lightbox-gallery__column {
  33. width: 25%;
  34. }
  35. }
  36. .lightbox-gallery .hidden {
  37. display: none;
  38. }
  39. {% endset %}
  40. {% do assets.addInlineCss(styling) %}
  41. {% block module_content %}
  42. {% set data = page.header.gallery %}
  43. {% set thumb_width = data.thumb.width|default(600) %}
  44. {% set thumb_height = data.thumb.height|default(450) %}
  45. <div class="lightbox-gallery">
  46. <div class="lightbox-gallery__columns">
  47. {% set gallery = md5(page.url) %}
  48. {% for item in data.items %}
  49. <div class="lightbox-gallery__column">
  50. {% set item_image = page.media[item.image] %}
  51. {% if item.title %}
  52. {% set title = item.title %}
  53. {% endif %}
  54. {% if item.desc %}
  55. {% set desc = ".desc-" ~ md5(item.desc) %}
  56. {% endif %}
  57. {% set content = item_image.cropZoom(thumb_width,thumb_height).html(title, title) %}
  58. {% set image = item_image.url %}
  59. {% include "partials/lightbox.html.twig" %}
  60. </div>
  61. {% endfor %}
  62. </div>
  63. <div class="hidden">
  64. {% for item in data.items %}
  65. {% if item.desc %}
  66. <div class="glightbox-desc desc-{{ md5(item.desc) }}">
  67. <p>{{ item.desc|markdown(false) }}</p>
  68. </div>
  69. {% endif %}
  70. {% endfor %}
  71. </div>
  72. </div>
  73. {% endblock %}