-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat](@svelteui/core): add new props to table and improve/fix styling
- Loading branch information
Margarida Silva
committed
Jan 18, 2024
1 parent
35d82a3
commit 348c75f
Showing
4 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import { HTMLAttributes } from 'svelte/elements'; | ||
import { DefaultProps, SvelteUINumberSize } from '$lib/styles'; | ||
|
||
export interface TableProps extends DefaultProps, HTMLAttributes<HTMLElement> { | ||
withBorder?: boolean; | ||
export interface TableProps<T = HTMLTableElement> | ||
extends DefaultProps<T>, | ||
HTMLAttributes<HTMLElement> { | ||
striped?: boolean; | ||
highlightOnHover?: boolean; | ||
cellPadding?: SvelteUINumberSize; | ||
textAlign?: 'center' | 'right' | 'left'; | ||
withRowBorder?: boolean; | ||
withColumnBorder?: boolean; | ||
withTableBorder?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
<script lang="ts"> | ||
import { Box } from '../Box'; | ||
import type { TableProps as $$TableProps } from './Table'; | ||
import useStyles from './Table.styles'; | ||
interface $$Props extends $$TableProps {} | ||
export let withBorder: $$Props['withBorder'] = false, | ||
striped: $$Props['striped'] = false, | ||
export let striped: $$Props['striped'] = false, | ||
highlightOnHover: $$Props['highlightOnHover'] = false, | ||
className: $$Props['className'] = 'table', | ||
cellPadding: $$Props['cellPadding'] = 'sm', | ||
textAlign: $$Props['textAlign'] = 'center'; | ||
textAlign: $$Props['textAlign'] = 'left', | ||
withRowBorder: $$Props['withRowBorder'] = true, | ||
withColumnBorder: $$Props['withColumnBorder'] = false, | ||
withTableBorder: $$Props['withTableBorder'] = false; | ||
$: ({ cx, classes } = useStyles( | ||
{ | ||
withBorder, | ||
striped, | ||
highlightOnHover, | ||
cellPadding, | ||
textAlign | ||
textAlign, | ||
withRowBorder, | ||
withColumnBorder, | ||
withTableBorder | ||
}, | ||
{ name: 'Table' } | ||
)); | ||
</script> | ||
|
||
<table class={cx(className, classes.root)}> | ||
<Box root="table" class={cx(className, classes.root)}> | ||
<slot /> | ||
</table> | ||
</Box> |