From 3642fca3a29be5461758af239fd50eea5ad10077 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Mon, 3 Mar 2025 13:18:12 +0000 Subject: [PATCH 1/7] Update properties table treatment --- app/pages/project/instances/InstancePage.tsx | 74 +++++++++---------- app/ui/lib/PropertiesTable.tsx | 44 ++++------- app/ui/styles/components/properties-table.css | 15 ---- 3 files changed, 51 insertions(+), 82 deletions(-) delete mode 100644 app/ui/styles/components/properties-table.css diff --git a/app/pages/project/instances/InstancePage.tsx b/app/pages/project/instances/InstancePage.tsx index 6079755b93..64998cf840 100644 --- a/app/pages/project/instances/InstancePage.tsx +++ b/app/pages/project/instances/InstancePage.tsx @@ -218,45 +218,41 @@ export default function InstancePage() { - - - - {instance.ncpus} - {pluralize(' vCPU', instance.ncpus)} - - - {memory.value} - {memory.unit} - - -
- - {instanceTransitioning(instance) && } - -
-
- - {vpc ? ( - - {vpc.name} - - ) : ( - - )} - -
- - - - - - {} - - -
+ + + {instance.ncpus} + {pluralize(' vCPU', instance.ncpus)} + + + {memory.value} + {memory.unit} + + +
+ + {instanceTransitioning(instance) && } + +
+
+ + {vpc ? ( + + {vpc.name} + + ) : ( + + )} + + + + + + {} + +
Storage Networking diff --git a/app/ui/lib/PropertiesTable.tsx b/app/ui/lib/PropertiesTable.tsx index 2741fc1e88..7f33d81bcb 100644 --- a/app/ui/lib/PropertiesTable.tsx +++ b/app/ui/lib/PropertiesTable.tsx @@ -9,7 +9,6 @@ import cn from 'classnames' import type { ReactNode } from 'react' import { DescriptionCell } from '~/table/cells/DescriptionCell' -import { Badge } from '~/ui/lib/Badge' import { isOneOf } from '~/util/children' import { invariant } from '~/util/invariant' @@ -19,9 +18,14 @@ import { Truncate } from './Truncate' export interface PropertiesTableProps { className?: string children: ReactNode + columns?: 1 | 2 } -export function PropertiesTable({ className, children }: PropertiesTableProps) { +export function PropertiesTable({ + className, + children, + columns = 1, +}: PropertiesTableProps) { invariant( isOneOf(children, [ PropertiesTable.Row, @@ -35,7 +39,13 @@ export function PropertiesTable({ className, children }: PropertiesTableProps) {
*:nth-child(-n+2)]:!border-t-0', + { + 'grid grid-cols-[minmax(min-content,1fr)_3fr]': columns === 1, + 'grid grid-cols-[minmax(min-content,1fr)_3fr] lg+:grid-cols-[minmax(min-content,1fr)_3fr_minmax(min-content,1fr)_3fr] lg+:[&>*:nth-child(-n+4)]:!border-t-0 lg+:[&>*:nth-child(4n-2)]:border-r': + columns === 2, + } )} > {children} @@ -49,10 +59,10 @@ interface PropertiesTableRowProps { } PropertiesTable.Row = ({ label, children }: PropertiesTableRowProps) => ( <> - - {label} + + {label} -
+
{children}
@@ -81,25 +91,3 @@ PropertiesTable.DateRow = ({ ) - -interface PropertiesTableGroupProps { - children: ReactNode - className?: string -} - -PropertiesTable.Group = ({ children, className }: PropertiesTableGroupProps) => { - invariant( - isOneOf(children, [PropertiesTable]), - 'PropertiesTable can only have PropertiesTable as a child' - ) - return ( -
- {children} -
- ) -} diff --git a/app/ui/styles/components/properties-table.css b/app/ui/styles/components/properties-table.css deleted file mode 100644 index 75bd703811..0000000000 --- a/app/ui/styles/components/properties-table.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * Copyright Oxide Computer Company - */ - -.properties-table { - grid-template-columns: minmax(min-content, 1fr) 3fr; -} - -.properties-table > *:nth-child(2) { - @apply !border-0; -} From 3ba8c073f5291e8b4109a98865137efc73ac133a Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Mon, 3 Mar 2025 13:18:27 +0000 Subject: [PATCH 2/7] Tweak copy button so it is not cut off --- app/ui/lib/Truncate.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/ui/lib/Truncate.tsx b/app/ui/lib/Truncate.tsx index b4dd18b464..12d63239bf 100644 --- a/app/ui/lib/Truncate.tsx +++ b/app/ui/lib/Truncate.tsx @@ -39,7 +39,9 @@ export const Truncate = ({ {truncate(text, maxLength, position)}
- {hasCopyButton && } +
+ {hasCopyButton && } +
) } From eae0c8acde4817dde58d10850b14a468044be195 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Mon, 3 Mar 2025 13:18:34 +0000 Subject: [PATCH 3/7] Spacing tweak --- app/ui/lib/DateTime.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/lib/DateTime.tsx b/app/ui/lib/DateTime.tsx index e2a0897e46..60dfe000c1 100644 --- a/app/ui/lib/DateTime.tsx +++ b/app/ui/lib/DateTime.tsx @@ -9,7 +9,7 @@ import { toLocaleDateString, toLocaleTimeString } from '~/util/date' export const DateTime = ({ date, locale }: { date: Date; locale?: string }) => ( -