Skip to content

Commit 7752c69

Browse files
committed
Reduce width of tables
1 parent 9cebadb commit 7752c69

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

frontend/src/components/SortableHeader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface Props {
99
filter?: React.ReactNode;
1010
activeColumn?: SortColumn;
1111
direction?: SortDirection;
12+
w?: number | string;
1213
}
1314

1415
export function SortableHeader({
@@ -17,12 +18,13 @@ export function SortableHeader({
1718
onSort,
1819
filter,
1920
activeColumn,
20-
direction
21+
direction,
22+
w
2123
}: Props) {
2224
const isActive = activeColumn === sortKey;
2325
const indicator = isActive ? (direction === 'asc' ? ' ↑' : ' ↓') : '';
2426
return (
25-
<Table.Th>
27+
<Table.Th style={w !== undefined ? { width: w, maxWidth: w } : undefined}>
2628
<Stack gap={0}>
2729
<UnstyledButton
2830
style={{ cursor: 'pointer', whiteSpace: 'nowrap' }}

frontend/src/components/TestRow.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function TestRow({ record, onOpen }: Props) {
8888

8989
return (
9090
<Table.Tr style={{ cursor: 'pointer' }} onClick={() => onOpen(record)}>
91-
<Table.Td style={{ whiteSpace: 'nowrap' }}>
91+
<Table.Td style={{ width: 75, maxWidth: 75, whiteSpace: 'nowrap' }}>
9292
<PixelDiffNumber value={latestData.pixelError} />
9393
<Tooltip label={diffTooltip} withArrow>
9494
<Text size={'xs'} c={diffColor}>{diffText}</Text>
@@ -97,11 +97,11 @@ export function TestRow({ record, onOpen }: Props) {
9797
<Text size={'xs'} c={nErrorsColor}>{nErrorsText}</Text>
9898
</Tooltip>
9999
</Table.Td>
100-
<Table.Td>{record.group}</Table.Td>
101-
<Table.Td>{record.name}</Table.Td>
102-
<Table.Td>{record.hardware}</Table.Td>
103-
<Table.Td>{timingDisplay(latestData.timing)}</Table.Td>
104-
<Table.Td>
100+
<Table.Td style={{ width: 200, maxWidth: 200, wordBreak: 'break-word' }}>{record.group}</Table.Td>
101+
<Table.Td style={{ width: 200, maxWidth: 200, wordBreak: 'break-word' }}>{record.name}</Table.Td>
102+
<Table.Td style={{ width: 100, maxWidth: 100, wordBreak: 'break-word' }}>{record.hardware}</Table.Td>
103+
<Table.Td style={{ width: 100, maxWidth: 100, wordBreak: 'break-word' }}>{timingDisplay(latestData.timing)}</Table.Td>
104+
<Table.Td style={{ width: 100, maxWidth: 100, wordBreak: 'break-word' }}>
105105
<Anchor
106106
href={`https://github.com/OpenSpace/OpenSpace/commit/${latestData.commitHash}`}
107107
target={'_blank'}
@@ -110,14 +110,14 @@ export function TestRow({ record, onOpen }: Props) {
110110
{latestData.commitHash.substring(0, 8)}
111111
</Anchor>
112112
</Table.Td>
113-
<Table.Td>
113+
<Table.Td style={{ width: 100, maxWidth: 100, wordBreak: 'break-word' }}>
114114
<Text>
115115
{new Date(latestData.timeStamp).toISOString().split('T')[0]}
116116
<br />
117117
{new Date(latestData.timeStamp).toISOString().split('T')[1]?.replace('Z', '')}
118118
</Text>
119119
</Table.Td>
120-
<Table.Td>
120+
<Table.Td style={{ width: 50, maxWidth: 50, wordBreak: 'break-word' }}>
121121
<Tooltip label={'Copy link'} withArrow>
122122
<ActionIcon
123123
variant={'subtle'}

frontend/src/pages/Home.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export default function Home() {
226226
onSort={handleSort}
227227
activeColumn={sortCol}
228228
direction={sortDir}
229+
w={160}
229230
filter={
230231
<TextInput
231232
placeholder="Filter..."
@@ -246,6 +247,7 @@ export default function Home() {
246247
onSort={handleSort}
247248
activeColumn={sortCol}
248249
direction={sortDir}
250+
w={160}
249251
filter={
250252
<TextInput
251253
placeholder="Filter..."

0 commit comments

Comments
 (0)