Use JS to show/hide railroad diagrams based on page width (thanks @hober!)

This commit is contained in:
Eryn Wells 2022-10-21 11:06:13 -07:00
parent 44f11c6792
commit 84c7c714ed
4 changed files with 77 additions and 19 deletions

View file

@ -0,0 +1,8 @@
{{- $parentID := .Parent.Get "id" -}}
{{- $narrowOnly := .Get "narrow" }}
<script defer type="module">
import { railroadDiagram } from {{ `/scripts/railroad-utils.js` | relURL }};
railroadDiagram(rr => {
{{ .Inner | safeJS }}
}, "{{ $parentID }}", {{ if $narrowOnly }}true{{ else }}false{{ end }});
</script>