Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 839670d

Browse files
committed
fix(DataTable): the DataTable component now uses th properly
1 parent 6b501a1 commit 839670d

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<script>
2+
import { getContext } from 'svelte';
3+
24
let klass = '';
35
export { klass as class };
46
57
export let numeric = false;
8+
9+
const isTableHead = getContext('is-table-head') === true;
610
</script>
711

812
<style lang="scss" src="./DataTableCell.scss" global>
913
</style>
1014

11-
<td class="s-tbl-cell {klass}" class:numeric>
12-
<slot />
13-
</td>
15+
{#if isTableHead}
16+
<th class="s-tbl-cell {klass}" class:numeric>
17+
<slot />
18+
</th>
19+
{:else}
20+
<td class="s-tbl-cell {klass}" class:numeric>
21+
<slot />
22+
</td>
23+
{/if}

packages/svelte-materialify/src/components/DataTable/DataTableHead.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<script>
2+
import { setContext } from 'svelte';
3+
24
let klass = '';
35
export { klass as class };
6+
7+
setContext('is-table-head', true);
48
</script>
59

610
<style lang="scss" src="./DataTableHead.scss" global>

packages/svelte-materialify/src/components/DataTable/DataTableRow.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import './variables';
2+
13
.s-tbl-row {
24
border-top-color: $tbl-border-color;
35
border-top-style: solid;

0 commit comments

Comments
 (0)