Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: checkbox and table styling #59

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const DataTable: React.FC<DataTableProps> = ({ allFiles, updateFileList }) => {
return (
<tr key={i}>
<td>
<div className="flex gap-4">
<div className="flex items-center gap-4">
<Checkbox.Root
name={file}
id={file}
className="mx-1 w-6 h-6 border"
className="p-0 w-4 h-4 border"
checked={selected}
onClick={() => handleSelect(selected, i)}
>
Expand All @@ -64,30 +64,32 @@ const DataTable: React.FC<DataTableProps> = ({ allFiles, updateFileList }) => {
})

return (
<table className="table-fixed border-spacing-2">
<thead>
<tr className="bg-neutral-100 text-left text-neutral-900">
<th className="flex w-[200px]">
<Checkbox.Root
name="selectAll"
id="selectAll"
className="mx-1 w-6 h-6 text-neutral-900"
onCheckedChange={handleSelectAll}
>
<Checkbox.Indicator>
<CheckIcon />
</Checkbox.Indicator>
</Checkbox.Root>
File Name
</th>
<th className="w-[200px]">Category</th>
<th>Description</th>
<th>File</th>
</tr>
</thead>
<div className="w-full overflow-x-scroll">
<table className="table-fixed border-spacing-2">
<thead>
<tr className="bg-neutral-100 text-left text-neutral-900">
<th className="flex items-center w-[200px]">
<Checkbox.Root
name="selectAll"
id="selectAll"
className="p-0 w-4 h-4 text-neutral-900 border"
onCheckedChange={handleSelectAll}
>
<Checkbox.Indicator>
<CheckIcon />
</Checkbox.Indicator>
</Checkbox.Root>
File Name
</th>
<th className="w-[200px]">Category</th>
<th>Description</th>
<th>File</th>
</tr>
</thead>

<tbody>{selectedFiles}</tbody>
</table>
<tbody>{selectedFiles}</tbody>
</table>
</div>
)
}
export default DataTable
7 changes: 5 additions & 2 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@
button[role="checkbox"] {
@apply bg-neutral-50;
@apply justify-center;
@apply shadow-md;
@apply rounded-md;
@apply rounded-none;
@apply text-neutral-900;
}

button[role="checkbox"]:hover {
@apply shadow-none;
}

th {
@apply font-bold;
@apply px-4;
Expand Down