summaryrefslogtreecommitdiffstats
path: root/apps/web-shared/src/components/table/tcell.svelte
blob: 76f500fe650694c9735d947ae721ac43b5459d9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script lang="ts">
    export let thScope: "row"|"col"|"rowgroup"|"colgroup"|"";
    export let colspan = "";
    export let type: "th"|"td" = "td";
    export let style;

    $: shared_props = {
        colspan: colspan || null,
        style: style || null,
        class: [type === "th" ? "int-table__cell--th" : "", "int-table__cell", $$restProps.class ?? ""].filter(Boolean).join(" "),
    };
</script>
{#if type === "th"}
    <th {thScope}
        {...shared_props}>
        <slot/>
    </th>
{/if}
{#if type === "td"}
    <td {...shared_props}>
        <slot/>
    </td>
{/if}