Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ interface ResourceColGroupProps {
hasCheckbox?: boolean
}

const CHECKBOX_WEIGHT = 0.4
const CHECKBOX_COLUMN_WIDTH_PX = 52
const CHECKBOX_COLUMN_WIDTH = `${CHECKBOX_COLUMN_WIDTH_PX}px`

const ResourceColGroup = memo(function ResourceColGroup({
columns,
Expand All @@ -651,14 +652,27 @@ const ResourceColGroup = memo(function ResourceColGroup({
const weights = columns.map(
(col, colIdx) => (colIdx === 0 ? 2.5 : 1.0) * (col.widthMultiplier ?? 1)
)
const total = (hasCheckbox ? CHECKBOX_WEIGHT : 0) + weights.reduce((s, w) => s + w, 0)
const total = weights.reduce((s, w) => s + w, 0)

return (
<colgroup>
{hasCheckbox && <col style={{ width: `${(CHECKBOX_WEIGHT / total) * 100}%` }} />}
{columns.map((col, colIdx) => (
<col key={col.id} style={{ width: `${(weights[colIdx] / total) * 100}%` }} />
))}
{hasCheckbox && <col style={{ width: CHECKBOX_COLUMN_WIDTH }} />}
{columns.map((col, colIdx) => {
const columnRatio = weights[colIdx] / total
const columnPercent = columnRatio * 100
const checkboxOffset = CHECKBOX_COLUMN_WIDTH_PX * columnRatio

return (
<col
key={col.id}
style={{
width: hasCheckbox
? `calc(${columnPercent}% - ${checkboxOffset}px)`
: `${columnPercent}%`,
}}
/>
)
})}
</colgroup>
)
})
Expand Down
16 changes: 8 additions & 8 deletions bun.lock

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"husky": "9.1.7",
"json-schema-to-typescript": "15.0.4",
"lint-staged": "16.0.0",
"turbo": "2.9.6",
"turbo": "2.9.12",
"yaml": "^2.8.1"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://v2-9-6.turborepo.dev/schema.json",
"$schema": "https://v2-9-12.turborepo.dev/schema.json",
"envMode": "loose",
"tasks": {
"transit": {
Expand Down
Loading