Skip to content

Commit d36ac5f

Browse files
fix: improve connections table layout and styling (#1712)
- Adjust column widths: reduce Details and Close columns size on desktop - Increase width for ID, Host, SniffHost, and Chains columns - Reorder header elements: text first, then icons on the right - Remove justify alignment for tighter header spacing - Fix mobile view: reduce vertical spacing between rows - Add proper spacing between mobile card-style rows - Update border colors to match theme consistency
1 parent 8a5b2fe commit d36ac5f

File tree

1 file changed

+54
-23
lines changed

1 file changed

+54
-23
lines changed

src/pages/Connections.tsx

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -576,30 +576,31 @@ export default () => {
576576
<tr class="flex">
577577
<For each={headerGroup.headers}>
578578
{(header) => (
579-
<th class="w-36 min-w-36 bg-base-200 sm:w-40 sm:min-w-40 md:w-44 md:min-w-44 lg:w-68 lg:min-w-48">
580-
<div
581-
class={twMerge(
582-
'flex items-center gap-2 text-justify',
583-
)}
584-
>
585-
{header.column.getCanGroup() ? (
586-
<button
587-
class="cursor-pointer"
588-
onClick={header.column.getToggleGroupingHandler()}
589-
>
590-
{header.column.getIsGrouped() ? (
591-
<IconZoomOutFilled size={18} />
592-
) : (
593-
<IconZoomInFilled size={18} />
594-
)}
595-
</button>
596-
) : null}
597-
579+
<th
580+
class={twMerge(
581+
'w-36 min-w-36 bg-base-200 sm:w-40 sm:min-w-40 md:w-44 md:min-w-44 lg:w-24',
582+
(header.id ===
583+
CONNECTIONS_TABLE_ACCESSOR_KEY.Details ||
584+
header.id ===
585+
CONNECTIONS_TABLE_ACCESSOR_KEY.Close) &&
586+
'md:w-16 md:min-w-16 lg:w-14 lg:min-w-14',
587+
(header.id === CONNECTIONS_TABLE_ACCESSOR_KEY.ID ||
588+
header.id ===
589+
CONNECTIONS_TABLE_ACCESSOR_KEY.Host ||
590+
header.id ===
591+
CONNECTIONS_TABLE_ACCESSOR_KEY.SniffHost) &&
592+
'md:w-64 md:min-w-64',
593+
header.id ===
594+
CONNECTIONS_TABLE_ACCESSOR_KEY.Chains &&
595+
'md:w-80 md:min-w-80',
596+
)}
597+
>
598+
<div class="flex items-center gap-2">
598599
<div
599600
class={twMerge(
600601
header.column.getCanSort() &&
601602
'cursor-pointer select-none',
602-
'justify flex-1 text-xs wrap-break-word whitespace-normal',
603+
'text-xs wrap-break-word whitespace-normal',
603604
)}
604605
onClick={header.column.getToggleSortingHandler()}
605606
>
@@ -613,6 +614,19 @@ export default () => {
613614
asc: <IconSortAscending />,
614615
desc: <IconSortDescending />,
615616
}[header.column.getIsSorted() as string] ?? null}
617+
618+
{header.column.getCanGroup() ? (
619+
<button
620+
class="cursor-pointer"
621+
onClick={header.column.getToggleGroupingHandler()}
622+
>
623+
{header.column.getIsGrouped() ? (
624+
<IconZoomOutFilled size={18} />
625+
) : (
626+
<IconZoomInFilled size={18} />
627+
)}
628+
</button>
629+
) : null}
616630
</div>
617631
</th>
618632
)}
@@ -629,7 +643,7 @@ export default () => {
629643
item={(props) => (
630644
<tr
631645
{...props}
632-
class="border-base-400 even:bg-base-400 flex flex-wrap border-t odd:bg-base-100 md:table-row md:border-t-0"
646+
class="even:bg-base-500 flex flex-wrap rounded-xl border-4 border-base-300 px-2 odd:bg-base-100 md:table-row md:rounded-none md:border-0 md:px-0"
633647
/>
634648
)}
635649
>
@@ -638,7 +652,24 @@ export default () => {
638652
{(cell) => {
639653
return (
640654
<td
641-
class="w-1/2 min-w-[50%] py-4 text-justify align-top wrap-break-word nth-[2n]:text-right sm:w-1/3 sm:min-w-[33.333%] sm:nth-[2n]:text-justify sm:nth-[3n]:text-right md:inline-block md:w-44 md:min-w-44 md:py-3 md:text-start md:nth-[2n]:text-start md:nth-[3n]:text-start lg:w-68 lg:min-w-48"
655+
class={twMerge(
656+
'md:-1.5 w-1/2 min-w-[50%] pb-1.5 text-justify align-top wrap-break-word nth-[2n]:text-right nth-last-[2]:mb-3 sm:w-1/3 sm:min-w-[33.333%] sm:nth-[2n]:text-justify sm:nth-[3n]:text-right md:inline-block md:w-44 md:min-w-44 md:py-3 md:text-start md:nth-[2n]:text-start md:nth-[3n]:text-start md:nth-last-[2]:mb-3 lg:w-24',
657+
(cell.column.id ===
658+
CONNECTIONS_TABLE_ACCESSOR_KEY.Details ||
659+
cell.column.id ===
660+
CONNECTIONS_TABLE_ACCESSOR_KEY.Close) &&
661+
'md:w-16 md:min-w-16 lg:w-14 lg:min-w-14',
662+
(cell.column.id ===
663+
CONNECTIONS_TABLE_ACCESSOR_KEY.ID ||
664+
cell.column.id ===
665+
CONNECTIONS_TABLE_ACCESSOR_KEY.Host ||
666+
cell.column.id ===
667+
CONNECTIONS_TABLE_ACCESSOR_KEY.SniffHost) &&
668+
'md:w-64 md:min-w-64',
669+
cell.column.id ===
670+
CONNECTIONS_TABLE_ACCESSOR_KEY.Chains &&
671+
'md:w-80 md:min-w-80',
672+
)}
642673
onContextMenu={(e) => {
643674
e.preventDefault()
644675

@@ -648,7 +679,7 @@ export default () => {
648679
}}
649680
>
650681
{/* Mobile label */}
651-
<div class="justify mb-1 text-[10px] text-base-content/60 uppercase md:hidden">
682+
<div class="justify mb-0.5 text-[10px] text-base-content/60 uppercase md:hidden">
652683
{(() => {
653684
const key = (
654685
cell.column.columnDef.meta as ColMeta | undefined

0 commit comments

Comments
 (0)