90 lines
2.2 KiB
Plaintext
90 lines
2.2 KiB
Plaintext
|
|
<h2>Single templates</h2>
|
|
|
|
{{ define "inactiveBrick" }}
|
|
<div
|
|
class="h-8 w-20 border-[hsl(var(--brick-color))]/25 border bg-[hsl(var(--brick-color))]/5"
|
|
style="--brick-color: var({{.}})"
|
|
></div>
|
|
{{ end }}
|
|
|
|
{{ define "raisedBrick" }}
|
|
<div
|
|
class="h-8 w-20 border-[hsl(var(--brick-color))] border-2 bg-[hsl(var(--brick-color))]/25"
|
|
style="--brick-color: var({{.}})"
|
|
></div>
|
|
{{ end }}
|
|
|
|
{{ define "speakerBrick" }}
|
|
<div
|
|
class="h-8 w-20 border-[hsl(var(--brick-color))] border-2 bg-[hsl(var(--brick-color))]/50 shadow-[0_0_15px_rgba(0,_0,_0,_0.5)] shadow-[hsl(var(--brick-color))] animate-pulse"
|
|
style="--brick-color: var({{.}})"
|
|
></div>
|
|
{{ end }}
|
|
|
|
{{ define "markBrick" }}
|
|
<div
|
|
class="h-8 w-20 border-[hsl(var(--brick-color))]/25 border bg-[hsl(var(--brick-color))]/5 grid place-content-center font-bold text-[hsl(var(--brick-color))]/50"
|
|
style="--brick-color: var({{.}})"
|
|
>
|
|
X
|
|
</div>
|
|
{{ end }}
|
|
|
|
|
|
<h2>For each type</h2>
|
|
{{ range .Bricks }}
|
|
<div class="border-2">for {{ .Name }}</div>
|
|
<div
|
|
class="border-2 p-3 flex flex-row gap-x-3"
|
|
style="--brick-color: var({{ .ColorClass }})"
|
|
>
|
|
{{ template "inactiveBrick" .ColorClass }} {{ template "raisedBrick"
|
|
.ColorClass }} {{ template "speakerBrick" .ColorClass }} {{ template
|
|
"markBrick" .ColorClass }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
|
|
<h2>Now for BrickData taking parametrized template name</h2>
|
|
{{ define "brick" }}
|
|
|
|
{{ if eq .TemplateType "inactiveBrick" }}
|
|
{{ template "inactiveBrick" .ColorClass }}
|
|
|
|
{{ else if eq .TemplateType "raisedBrick" }}
|
|
{{ template "raisedBrick" .ColorClass }}
|
|
|
|
{{ else if eq .TemplateType "speakerBrick" }}
|
|
{{ template "speakerBrick" .ColorClass }}
|
|
|
|
{{ else if eq .TemplateType "markBrick" }}
|
|
{{ template "markBrick" .ColorClass }}
|
|
{{ end }}
|
|
|
|
{{end}}
|
|
|
|
<h2>Now for a person</h2>
|
|
{{ define "personBlocks" }}
|
|
|
|
<div>
|
|
{{ range (bricksForPerson .) }}
|
|
{{ template "brick" . }}
|
|
{{ end }}
|
|
<p>{{ .Name }}</p>
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
|
|
<h2>And now i'll want to get all persons for a room</h2>
|
|
{{ define "roomPeople" }}
|
|
<div
|
|
class="flex flex-row"
|
|
>
|
|
{{ range (personsFromRoom .) }}
|
|
{{ template "personBlocks" . }}
|
|
{{ end }}
|
|
</div>
|
|
{{end}}
|