Skip to content

Commit

Permalink
Add className support to DataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszbachorski committed Jul 5, 2024
1 parent 1f8cd2e commit 3f65ca0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ const meta: Meta<typeof DataTable> = {
export default meta

export const Default = () => (
<DataTable columns={peopleColumns} data={peopleData} />
<DataTable columns={peopleColumns} data={peopleData} className="m-5" />
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ import {
TableHeader,
TableRow,
} from '../Table'
import { cn } from '../../utils/className'

Check warning on line 17 in packages/design-system/src/components/DataTable/DataTable.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/design-system/src/components/DataTable/DataTable.tsx#L17

[import/order] `../../utils/className` import should occur before import of `../Table`

interface DataTableProps<TData, TValue> {
columns: Array<ColumnDef<TData, TValue>>
data: TData[]
className?: string
}

export const DataTable = <TData, TValue>({
columns,
data,
className,
}: DataTableProps<TData, TValue>) => {
const table = useReactTable({
data,
Expand All @@ -32,7 +35,7 @@ export const DataTable = <TData, TValue>({
const rows = table.getRowModel().rows

return (
<div className="rounded-md border">
<div className={cn('rounded-md border', className)}>
<Table>
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
Expand Down

0 comments on commit 3f65ca0

Please sign in to comment.