Skip to content

Commit 19d09d0

Browse files
authored
Merge pull request #221 from silinternational/feat/add-lowContrast-to-DataRowItem
add(DataTable): add lowContrast prop to DataRowItem
2 parents 3b0e990 + bf1bbef commit 19d09d0

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
<script>
2+
/**
3+
* @prop {boolean}
4+
* @description Whether the cell contains numeric data.
5+
*/
26
export let numeric = false
7+
/**
8+
* @prop {number}
9+
* @description The number of columns the cell spans.
10+
*/
311
export let colspan = 1
12+
/**
13+
* @prop {boolean}
14+
* @description Whether the cell has low contrast.
15+
*/
16+
export let lowContrast = false
417
</script>
518

6-
<td class="mdc-data-table__cell {$$props.class || ''}" class:mdc-data-table__cell--numeric={numeric} {colspan}
7-
><slot /></td
19+
<style>
20+
.lowContrast {
21+
color: var(--mdc-theme-text-secondary-on-light);
22+
}
23+
</style>
24+
25+
<td
26+
class="mdc-data-table__cell {$$props.class || ''}"
27+
class:lowContrast
28+
class:mdc-data-table__cell--numeric={numeric}
29+
{colspan}
830
>
31+
<slot />
32+
</td>

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ declare module '@silintl/ui-components' {
8484
numeric?: boolean
8585
colspan?: number
8686
class?: string
87+
lowContrast?: boolean
8788
}
8889
export class Item extends SvelteComponentTyped<ItemProps> {}
8990
}

stories/DataRowItem.stories.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { copyAndModifyArgs } from './helpers.js'
55
66
const args = {
77
class: '', //only works for global classes
8+
numeric: false,
9+
colspan: 1,
10+
lowContrast: false,
811
}
912
</script>
1013

@@ -16,6 +19,8 @@ const args = {
1619

1720
<Story name="Default" {args} />
1821

19-
<Story name="Numberic" args={copyAndModifyArgs(args, { numeric: 'true' })} />
22+
<Story name="Numeric" args={copyAndModifyArgs(args, { numeric: 'true' })} />
23+
24+
<Story name="LowContrast" args={copyAndModifyArgs(args, { lowContrast: 'true' })} />
2025

2126
<Story name="Colspan 1" args={copyAndModifyArgs(args, { colspan: 1 })} />

0 commit comments

Comments
 (0)