chore(templates): prettier plugin & tables
This commit is contained in:
25
templates/components/activity.tmpl
Normal file
25
templates/components/activity.tmpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{ template "base" . }}
|
||||
{{ define "title" }}Activity{{ end }}
|
||||
{{ define "header" }}<a href="./activity">Activity</a>{{ end }}
|
||||
{{ define "content" }}
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block min-w-full overflow-hidden rounded shadow">
|
||||
<!-- Table Component - Utilizes Template "table-cell" -->
|
||||
{{ template "component/table" (dict
|
||||
"Columns" (slice "Document" "Time" "Duration" "Percent")
|
||||
"Keys" (slice "Document" "StartTime" "Duration" "EndPercentage")
|
||||
"Rows" .Data
|
||||
)}}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
<!-- Table Cell Definition -->
|
||||
{{ define "table-cell" }}
|
||||
{{ if eq .Name "Document" }}
|
||||
<a href="./documents/{{ .Data.DocumentID }}">{{ .Data.Author }} - {{ .Data.Title }}</a>
|
||||
{{ else if eq .Name "EndPercentage" }}
|
||||
{{ index (fields .Data) .Name }}%
|
||||
{{ else }}
|
||||
{{ index (fields .Data) .Name }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -1,14 +1,21 @@
|
||||
<!-- Variant -->
|
||||
{{ $baseClass := "transition duration-100 ease-in font-medium w-full h-full px-2 py-1 text-white" }}
|
||||
{{ if eq .Variant "Secondary" }}
|
||||
{{ $baseClass = printf "bg-black shadow-md hover:text-black hover:bg-white %s" $baseClass }}
|
||||
{{ $baseClass = printf "bg-black shadow-md hover:text-black hover:bg-white %s" $baseClass }}
|
||||
{{ else }}
|
||||
{{ $baseClass = printf "bg-gray-500 dark:text-gray-800 hover:bg-gray-800 dark:hover:bg-gray-100 %s" $baseClass }}
|
||||
{{ $baseClass = printf "bg-gray-500 dark:text-gray-800 hover:bg-gray-800 dark:hover:bg-gray-100 %s" $baseClass }}
|
||||
{{ end }}
|
||||
<!-- Type -->
|
||||
{{ if eq .Type "Link" }}
|
||||
<a href="{{ .URL }}" class="text-center {{ $baseClass }}" type="submit">{{ .Title }}</a>
|
||||
<a href="{{ .URL }}" class="text-center {{ $baseClass }}" type="submit"
|
||||
>{{ .Title }}</a
|
||||
>
|
||||
{{ else }}
|
||||
<button class="{{ $baseClass }}" type="submit" {{ if .FormName }} form="{{ .FormName}}" {{ end }}>{{ .Title }}
|
||||
</button>
|
||||
<button
|
||||
class="{{ $baseClass }}"
|
||||
type="submit"
|
||||
{{ if .FormName }}form="{{ .FormName }}"{{ end }}
|
||||
>
|
||||
{{ .Title }}
|
||||
</button>
|
||||
{{ end }}
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
{{ range $row := $rows }}
|
||||
<tr>
|
||||
{{ range $key := $keys }}
|
||||
<td class="p-3 border-b border-gray-200">
|
||||
<p>{{ index (fields $row) $key }}</p>
|
||||
</td>
|
||||
<td class="p-3 border-b border-gray-200">{{ template "table-cell" (dict "Data" $row "Name" $key )}}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user