Skip to content

Commit

Permalink
improve table styling
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Jul 2, 2024
1 parent a4b2526 commit 5003371
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@tanstack/react-table": "^8.17.3",
"@tanstack/react-virtual": "^3.7.0",
"axios": "^1.7.2",
"classnames": "^2.5.1",
"django-vite-plugin": "^4.0.1",
"react": "^18.3.1",
"react-datepicker": "^7.2.0",
Expand Down
11 changes: 10 additions & 1 deletion src/frontend/src/samples/components/Cell/MultiSelectCell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import AsyncSelect from "react-select/async";

const datePortal = document.getElementById('date-portal');

const CLASSNAMES = {
container: () => 'flex w-full',
control: (state) => 'px-4 w-full cursor-auto',
menu: () => 'bg-white border border-[#444] cursor-auto',
option: () => 'px-4 my-2 cursor-auto focus:bg-primary',
multiValue: () => 'bg-primary px-1 rounded cursor-auto',
}

export default function MultiSelectCell({
getValue,
row: { original },
Expand Down Expand Up @@ -42,10 +50,11 @@ export default function MultiSelectCell({
getOptionValue={(o) => o[idField]}
onBlur={handleBlur}
classNamePrefix="react-select"
className=""
classNames={CLASSNAMES}
value={value}
onChange={setValue}
menuPortalTarget={datePortal}
unstyled
/>
);
}
12 changes: 11 additions & 1 deletion src/frontend/src/samples/components/Cell/SelectCell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import AsyncSelect from "react-select/async";

const datePortal = document.getElementById('date-portal');


const CLASSNAMES = {
container: () => 'flex w-full',
control: (state) => 'px-4 w-full cursor-auto',
menu: () => 'bg-white border border-[#444] cursor-auto',
option: () => 'px-4 my-2 cursor-auto hover:bg-primary',
multiValue: () => 'bg-primary px-1 rounded cursor-auto',
}

export default function SelectCell({
getValue,
row: { original },
Expand Down Expand Up @@ -38,10 +47,11 @@ export default function SelectCell({
getOptionValue={(o) => o.id}
onBlur={handleBlur}
classNamePrefix="react-select"
className=""
classNames={CLASSNAMES}
value={value}
onChange={setValue}
menuPortalTarget={datePortal}
unstyled
/>
);
}
2 changes: 1 addition & 1 deletion src/frontend/src/samples/components/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export default function Table() {
return (
<td
key={cell.id}
className="border-b border-r first:border-l border-[#333] flex"
className="border-b border-r first:border-l border-[#444] flex"
style={{
width: cell.column.getSize(),
}}
Expand Down

0 comments on commit 5003371

Please sign in to comment.