chore(templates): component-ize things
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
28
templates/components/table.tmpl
Normal file
28
templates/components/table.tmpl
Normal file
@@ -0,0 +1,28 @@
|
||||
{{ $rows := .Rows }}
|
||||
{{ $cols := .Columns }}
|
||||
{{ $keys := .Keys }}
|
||||
<table class="min-w-full leading-normal bg-white dark:bg-gray-700 text-sm">
|
||||
<thead class="text-gray-800 dark:text-gray-400">
|
||||
<tr>
|
||||
{{ range $col := $cols }}
|
||||
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800">{{ $col }}</th>
|
||||
{{ end }}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-black dark:text-white">
|
||||
{{ if not $rows }}
|
||||
<tr>
|
||||
<td class="text-center p-3" colspan="4">No Results</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ range $row := $rows }}
|
||||
<tr>
|
||||
{{ range $key := $keys }}
|
||||
<td class="p-3 border-b border-gray-200">
|
||||
<p>{{ index (fields $row) $key }}</p>
|
||||
</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user