button.html 606 B

123456789101112131415161718192021222324252627282930
  1. {{- $ref := "" }}
  2. {{- $class := "" }}
  3. {{- $size := default "regular" (.Get "size" | lower) }}
  4. {{- if not (in (slice "regular" "large") $size) }}
  5. {{- $size = "regular" }}
  6. {{- end }}
  7. {{- with .Get "href" }}
  8. {{- $ref = . }}
  9. {{- end }}
  10. {{- with .Get "relref" }}
  11. {{- $ref = relref $ . }}
  12. {{- end }}
  13. {{- with .Get "class" }}
  14. {{- $class = . }}
  15. {{- end }}
  16. <span class="gdoc-button gdoc-button--{{ $size }}{{ with $class }}{{ printf " %s" . }}{{ end }}">
  17. <a
  18. class="gdoc-button__link"
  19. {{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
  20. >
  21. {{ $.Inner }}
  22. </a>
  23. </span>