/
ClassTable.svelte
60 lines (59 loc) · 2.54 KB
/
ClassTable.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script>
import { prefix } from "$lib/stores"
import PrefixEdit from "@components/PrefixEdit.svelte"
import Translate from "@components/Translate.svelte"
import { t } from "@src/lib/i18n"
export let data
</script>
<div class="not-prose mt-6 mb-10 overflow-x-auto">
<table class="table-compact table w-full">
<thead>
<tr>
<th class="flex items-center gap-2 normal-case">
<PrefixEdit />
<span><Translate text="Class name" /></span>
</th>
<th class="normal-case"><Translate text="Type" /></th>
<th />
</tr>
</thead>
<tbody>
{#if $prefix}
<tr>
<td colspan="3" class="!px-0">
<div class="text-info-content bg-info relative inline-flex items-center gap-2 rounded-lg p-2 px-3">
<svg class="fill-info absolute -top-1.5 left-8 scale-x-150" xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 512 512"><polygon points="256 32 20 464 492 464 256 32" /></svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info-content h-4 w-4 flex-shrink-0"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
<div class="text-xs">
<Translate text="To use a custom prefix, <a class='link' href='/docs/config/#prefix'>add your prefix string to config</a>" />
</div>
</div>
</td>
</tr>
{/if}
{#each data as item, index}
<tr>
<th class="font-normal">
<span class="font-mono lowercase">{`${$prefix}${item.class}`}</span>
</th>
<td>
{#if item.type == "component"}
<span class="badge badge-sm badge-ghost w-20"><Translate text="Component" /></span>
{/if}
{#if item.type == "modifier"}
<div class="tooltip tooltip-right cursor-help" data-tip={$t("Changes the style of a component")}>
<span class="badge badge-sm badge-outline w-20"><Translate text="Modifier" /></span>
</div>
{/if}
{#if item.type == "responsive"}
<div class="tooltip tooltip-right cursor-help" data-tip={$t("Supports responsive prefixes (sm:, lg:, …)")}>
<span class="badge badge-sm badge-success w-20"><Translate text="Responsive" /></span>
</div>
{/if}
</td>
<td>{item.desc}</td>
</tr>
{/each}
</tbody>
</table>
</div>