sections.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. {{/* One template per section type. Each receives a Section. */}}
  2. {{define "attrs"}}{{with .ID}} id="{{.}}"{{end}}{{end}}
  3. {{define "tone"}}{{with .Tone}} tone-{{.}}{{end}}{{end}}
  4. {{define "head"}}{{if or .Eyebrow .Title .Text}}<div class="sec-head rv">
  5. {{with .Eyebrow}}<p class="eyebrow">{{tr .}}</p>{{end}}
  6. {{with .Title}}<h2 class="title">{{tr .}}</h2>{{end}}
  7. {{with .Text}}<p class="lead">{{tr .}}</p>{{end}}
  8. </div>{{end}}{{end}}
  9. {{define "buttons"}}{{range .}}<a class="btn {{or .Style "primary"}}" href="{{href .Href}}"{{if ext .Href}} target="_blank" rel="noopener"{{end}}>{{with .Icon}}{{icon .}}{{end}}<span>{{if .UI}}{{ui .UI}}{{else}}{{tr .Label}}{{end}}</span>{{if eq .Style "link"}}{{icon "chevron"}}{{end}}</a>{{end}}{{end}}
  10. {{define "app-row"}}<div class="app-row">{{range .}}{{with app .}}<img src="{{.Src}}" alt="{{.Name}}" title="{{.Name}}" width="56" height="56" loading="lazy" decoding="async">{{end}}{{end}}</div>{{end}}
  11. {{define "hero"}}{{$s := .}}<section class="hero{{template "tone" .}}"{{template "attrs" .}}>
  12. <div class="wrap hero-head">
  13. {{with .Eyebrow}}<p class="eyebrow rv">{{tr .}}</p>{{end}}
  14. <h1 class="hero-title rv" style="--d:1">{{tr .Title}}</h1>
  15. {{with .Text}}<p class="hero-sub rv" style="--d:2">{{tr .}}</p>{{end}}
  16. {{with .Buttons}}<div class="btns center rv" style="--d:3">{{template "buttons" .}}</div>{{end}}
  17. </div>
  18. {{with img .Image}}<div class="hero-media" data-scale="hero"><img src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="{{trs (or $s.Alt $s.Title)}}" fetchpriority="high" decoding="async"></div>
  19. {{else}}{{with $s.Apps}}<div class="hero-apps" aria-hidden="true">{{range $i, $k := .}}{{with app $k}}<img class="float" style="--i:{{$i}}" src="{{.Src}}" alt="" width="96" height="96">{{end}}{{end}}</div>{{end}}{{end}}
  20. </section>{{end}}
  21. {{define "feature"}}{{$s := .}}{{$m := img .Image}}<section class="feature layout-{{or .Layout "stack"}}{{if .Flip}} flip{{end}}{{if and (not $m) (not .Code) (not .Phones)}} no-media{{end}}{{template "tone" .}}"{{template "attrs" .}}>
  22. <div class="wrap feature-in">
  23. <div class="f-text rv">
  24. {{with .Apps}}{{template "app-row" .}}{{end}}
  25. {{with .Eyebrow}}<p class="eyebrow">{{tr .}}</p>{{end}}
  26. <h2 class="title">{{tr .Title}}</h2>
  27. {{with .Text}}<p class="lead">{{tr .}}</p>{{end}}
  28. {{with .Bullets}}<ul class="checks">{{range .}}<li>{{icon "check"}}<span>{{tr .}}</span></li>{{end}}</ul>{{end}}
  29. {{with .Note}}<p class="note">{{tr .}}</p>{{end}}
  30. {{with .Buttons}}<div class="btns">{{template "buttons" .}}</div>{{end}}
  31. </div>
  32. {{with $m}}<figure class="f-media" data-scale><img src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="{{trs (or $s.Alt $s.Title)}}" loading="lazy" decoding="async"></figure>
  33. {{else}}{{with $s.Code}}<figure class="f-code rv"><div class="code-bar"><span></span><span></span><span></span></div><pre><code>{{code .}}</code></pre></figure>{{end}}{{end}}
  34. {{if and $m $s.Code}}<figure class="f-code rv"><div class="code-bar"><span></span><span></span><span></span></div><pre><code>{{code $s.Code}}</code></pre></figure>{{end}}
  35. {{with .Phones}}<div class="f-phones">{{range $i, $n := .}}{{with img $n}}<figure class="phone rv" style="--d:{{$i}}"><img src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="{{trs $s.Title}}" loading="lazy" decoding="async"></figure>{{end}}{{end}}</div>{{end}}
  36. </div>
  37. </section>{{end}}
  38. {{define "showcase"}}<section class="showcase{{template "tone" .}}"{{template "attrs" .}} style="--n:{{len .Items}}">
  39. <div class="wrap">{{template "head" .}}</div>
  40. <div class="sc-track">
  41. <div class="sc-sticky">
  42. <div class="sc-media">{{range $i, $it := .Items}}{{with img $it.Image}}<img class="sc-img{{if eq $i 0}} on{{end}}" data-i="{{$i}}" src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="{{trs $it.Title}}" loading="lazy" decoding="async">{{end}}{{end}}</div>
  43. <div class="sc-caps">{{range $i, $it := .Items}}<div class="sc-cap{{if eq $i 0}} on{{end}}" data-i="{{$i}}"><h3>{{tr .Title}}</h3><p>{{tr .Text}}</p></div>{{end}}</div>
  44. <div class="sc-dots" aria-hidden="true">{{range $i, $it := .Items}}<span{{if eq $i 0}} class="on"{{end}}></span>{{end}}</div>
  45. </div>
  46. </div>
  47. {{with .Buttons}}<div class="wrap btns center sc-after">{{template "buttons" .}}</div>{{end}}
  48. </section>{{end}}
  49. {{define "lit"}}<section class="lit-sec{{template "tone" .}}"{{template "attrs" .}}>
  50. <div class="wrap narrow">
  51. {{with .Eyebrow}}<p class="eyebrow rv">{{tr .}}</p>{{end}}
  52. <p class="lit" data-lit>{{tr .Text}}</p>
  53. </div>
  54. </section>{{end}}
  55. {{define "stats"}}<section class="stats-sec{{template "tone" .}}"{{template "attrs" .}}>
  56. <div class="wrap">
  57. {{template "head" .}}
  58. <div class="stats">{{range $i, $it := .Items}}<div class="stat rv" style="--d:{{$i}}"><div class="stat-v" data-count>{{tr .Value}}</div><div class="stat-t">{{tr .Title}}</div>{{with .Text}}<p>{{tr .}}</p>{{end}}</div>{{end}}</div>
  59. </div>
  60. </section>{{end}}
  61. {{define "cards"}}<section class="cards-sec{{template "tone" .}}"{{template "attrs" .}}>
  62. <div class="wrap">
  63. {{template "head" .}}
  64. <div class="cards">{{range $i, $it := .Items}}<a class="card rv{{with .Size}} {{.}}{{end}} accent-{{or .Accent "index"}}" style="--d:{{mod $i 2}}" href="{{href .Link}}">
  65. <div class="card-text">
  66. {{with .Eyebrow}}<p class="eyebrow">{{tr .}}</p>{{end}}
  67. <h3>{{tr .Title}}</h3>
  68. {{with .Text}}<p>{{tr .}}</p>{{end}}
  69. <span class="more">{{ui "learnMore"}}{{icon "chevron"}}</span>
  70. </div>
  71. {{with img .Image}}<div class="card-media"><img src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="" loading="lazy" decoding="async"></div>
  72. {{else}}{{with $it.Apps}}<div class="card-apps">{{range $j, $k := .}}{{with app $k}}<img style="--i:{{$j}}" src="{{.Src}}" alt="" width="80" height="80" loading="lazy">{{end}}{{end}}</div>{{end}}{{end}}
  73. </a>{{end}}</div>
  74. </div>
  75. </section>{{end}}
  76. {{define "bento"}}<section class="bento-sec{{template "tone" .}}"{{template "attrs" .}}>
  77. <div class="wrap">
  78. {{template "head" .}}
  79. <div class="bento">{{range $i, $it := .Items}}<div class="tile rv{{with .Size}} {{.}}{{end}}" style="--d:{{mod $i 3}}">
  80. {{with .Icon}}<div class="tile-ic">{{icon .}}</div>{{end}}
  81. {{with .Apps}}{{template "app-row" .}}{{end}}
  82. {{with .Value}}<div class="tile-v">{{tr .}}</div>{{end}}
  83. {{with .Eyebrow}}<p class="eyebrow">{{tr .}}</p>{{end}}
  84. <h3>{{tr .Title}}</h3>
  85. {{with .Text}}<p>{{tr .}}</p>{{end}}
  86. {{with .Link}}<a class="more" href="{{href .}}">{{ui "learnMore"}}{{icon "chevron"}}</a>{{end}}
  87. {{with img .Image}}<img class="tile-img" src="{{.Src}}"{{if .W}} width="{{.W}}" height="{{.H}}"{{end}} alt="{{trs $it.Title}}" loading="lazy" decoding="async">{{end}}
  88. </div>{{end}}</div>
  89. </div>
  90. </section>{{end}}
  91. {{define "apps"}}<section class="apps-sec{{template "tone" .}}"{{template "attrs" .}}>
  92. <div class="wrap">
  93. {{template "head" .}}
  94. <ul class="app-grid">{{range $i, $k := .Apps}}{{with app $k}}<li class="rv" style="--d:{{mod $i 8}}"><img src="{{.Src}}" alt="" width="72" height="72" loading="lazy" decoding="async"><span>{{.Name}}</span></li>{{end}}{{end}}</ul>
  95. {{with .Note}}<p class="note center rv">{{tr .}}</p>{{end}}
  96. {{with .Buttons}}<div class="btns center rv">{{template "buttons" .}}</div>{{end}}
  97. </div>
  98. </section>{{end}}
  99. {{define "specs"}}<section class="specs-sec{{template "tone" .}}"{{template "attrs" .}}>
  100. <div class="wrap narrow">
  101. {{template "head" .}}
  102. <dl class="specs">{{range .Items}}<div class="spec rv">
  103. <dt>{{tr .Title}}</dt>
  104. <dd>{{with .Text}}<p>{{tr .}}</p>{{end}}{{with .Bullets}}<ul>{{range .}}<li>{{tr .}}</li>{{end}}</ul>{{end}}</dd>
  105. </div>{{end}}</dl>
  106. {{with .Note}}<p class="note rv">{{tr .}}</p>{{end}}
  107. </div>
  108. </section>{{end}}
  109. {{define "install"}}<section class="install-sec{{template "tone" .}}"{{template "attrs" .}}>
  110. <div class="wrap">
  111. {{template "head" .}}
  112. <div class="install">{{range $i, $it := .Items}}<article class="plat rv{{with .Size}} {{.}}{{end}}" style="--d:{{mod $i 2}}"{{with .Link}} id="{{.}}"{{end}}>
  113. <div class="plat-head">{{with .Icon}}<div class="tile-ic">{{icon .}}</div>{{end}}<div><h3>{{tr .Title}}</h3>{{with .Eyebrow}}<p class="plat-sub">{{tr .}}</p>{{end}}</div></div>
  114. {{with .Text}}<p>{{tr .}}</p>{{end}}
  115. {{with .Code}}<div class="cmd"><pre><code>{{.}}</code></pre><button type="button" class="copy" data-copy aria-label="{{uis "copy"}}" title="{{uis "copy"}}"><span class="c-copy">{{icon "copy"}}</span><span class="c-done">{{icon "check"}}</span></button></div>{{end}}
  116. {{with .Bullets}}<ol class="howto">{{range .}}<li>{{tr .}}</li>{{end}}</ol>{{end}}
  117. {{with .Buttons}}<div class="btns">{{template "buttons" .}}</div>{{end}}
  118. {{with .Note}}<p class="note">{{tr .}}</p>{{end}}
  119. </article>{{end}}</div>
  120. </div>
  121. </section>{{end}}
  122. {{define "steps"}}<section class="steps-sec{{template "tone" .}}"{{template "attrs" .}}>
  123. <div class="wrap">
  124. {{template "head" .}}
  125. <ol class="steps">{{range $i, $it := .Items}}<li class="rv" style="--d:{{$i}}"><span class="step-n">{{add $i 1}}</span><h3>{{tr .Title}}</h3>{{with .Text}}<p>{{tr .}}</p>{{end}}</li>{{end}}</ol>
  126. </div>
  127. </section>{{end}}
  128. {{define "cta"}}<section class="cta{{template "tone" .}}"{{template "attrs" .}}>
  129. <div class="wrap narrow rv">
  130. <div class="cta-logo">{{icon "logo"}}</div>
  131. <h2 class="title">{{tr .Title}}</h2>
  132. {{with .Text}}<p class="lead">{{tr .}}</p>{{end}}
  133. {{with .Buttons}}<div class="btns center">{{template "buttons" .}}</div>{{end}}
  134. </div>
  135. </section>{{end}}