section-card.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {{ $headerFontSize := 32 }}
  2. <div class="section__card" style="color: {{ .color | default "#fff" }}">
  3. {{ with .header }}
  4. {{ $headerFontSize = .fontSize }}
  5. {{ $header := . }}
  6. <header class="section__card--header">
  7. {{ with .title }}
  8. <h2 class="section__card--title" style="font-size:{{ $header.fontSize }}px; color:{{ $header.color | default "#fff" }};">{{ . }}</h2>
  9. {{ end }}
  10. {{ with .hlcolor }}
  11. <div class="section__highlight" style="width: {{ $header.width | default "220" }}px; background-color: {{ . | default "transparent" }};"></div>
  12. {{ end }}
  13. </header>
  14. {{ end }}
  15. {{ with .description }}
  16. <div class="section__card--main section__card--content" style="color: {{ $.color | default "#fff" }};">
  17. {{ . | markdownify }}
  18. </div>
  19. {{ end }}
  20. {{ with .cards }}
  21. <div class="section__card--main">
  22. {{ range . }}
  23. {{ $card := . }}
  24. <div class="section__card--item">
  25. {{ with .image }}
  26. <div class="section__card--img-wrapper">
  27. <img data-src="{{ . | relURL }}" alt="{{ $card.subtitle | default "section image" }}" src="data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath fill='%23aaa' d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 16H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1zm-4.44-6.19l-2.35 3.02-1.56-1.88c-.2-.25-.58-.24-.78.01l-1.74 2.23c-.26.33-.02.81.39.81h8.98c.41 0 .65-.47.4-.8l-2.55-3.39c-.19-.26-.59-.26-.79 0z'/%3E%3C/svg%3E" class="lazyload section__card--img"/>
  28. </div>
  29. {{ end }}
  30. <div class="section__card--submain">
  31. {{ with .subtitle }}
  32. <div class="section__card--subtitle" style="font-size:{{ with $headerFontSize }}{{ sub (int .) 4 }}px;{{ end }} color:{{ $card.color | default "#fff" }}; text-align: {{ $card.subtitlePosition | default "center" }}">
  33. {{ . }}
  34. </div>
  35. {{ end }}
  36. {{ with .description }}
  37. <div class="section__card--content" style="color: {{ $card.color | default "#fff" }};">
  38. {{ . | markdownify }}
  39. </div>
  40. {{ end }}
  41. {{ with .button }}
  42. <a href="{{ .link }}" class="section__card--item" target="{{ .target }}" rel="{{ if eq .target "_blank" }}noreferrer{{ end }}" data-mobile="true">
  43. <button class="section__btn section__btn--{{ .size }}" style="background-color: {{ .bgcolor | default "#000" }}; color: {{ .color | default "#fff" }};">{{ .name }}</button>
  44. </a>
  45. {{ end }}
  46. </div>
  47. </div>
  48. {{ end }}
  49. </div>
  50. {{ end }}
  51. {{ with .cards }}
  52. <div class="section__card--main" data-mobile="false">
  53. {{ range . }}
  54. {{ if .button }}
  55. {{ with .button }}
  56. <a href="{{ .link }}" class="section__card--item" target="{{ .target }}" rel="{{ if eq .target "_blank" }}noreferrer{{ end }}">
  57. <button class="section__btn section__btn--{{ .size }}" style="background-color: {{ .bgcolor }}; color: {{ .color }};">{{ .name }}</button>
  58. </a>
  59. {{ end }}
  60. {{ else }}
  61. <div class="section__card--item"></div>
  62. {{ end }}
  63. {{ end }}
  64. </div>
  65. {{ end }}
  66. </div>