From 3d45346c34b45f182d3dbbd0173c53c578c048b0 Mon Sep 17 00:00:00 2001 From: Robert Sese <734194+rsese@users.noreply.github.com> Date: Tue, 20 Sep 2022 14:57:49 -0500 Subject: [PATCH] New nested param table styles for REST (#30862) --- .../ChildBodyParametersRows.module.scss | 21 +++++ .../ChildBodyParametersRows.tsx | 28 +++--- components/parameter-table/ParameterRow.tsx | 94 +++++++++++++++++++ .../ParameterTable.module.scss | 20 ++++ .../ParameterTable.tsx} | 83 ++++++++-------- components/parameter-table/types.ts | 32 +++++++ components/rest/ParameterRow.tsx | 75 --------------- components/rest/RestOperation.tsx | 15 ++- data/ui.yml | 24 ++--- 9 files changed, 249 insertions(+), 143 deletions(-) create mode 100644 components/parameter-table/ChildBodyParametersRows.module.scss rename components/{rest => parameter-table}/ChildBodyParametersRows.tsx (63%) create mode 100644 components/parameter-table/ParameterRow.tsx create mode 100644 components/parameter-table/ParameterTable.module.scss rename components/{rest/RestParameterTable.tsx => parameter-table/ParameterTable.tsx} (63%) create mode 100644 components/parameter-table/types.ts delete mode 100644 components/rest/ParameterRow.tsx diff --git a/components/parameter-table/ChildBodyParametersRows.module.scss b/components/parameter-table/ChildBodyParametersRows.module.scss new file mode 100644 index 0000000000..dd2631c562 --- /dev/null +++ b/components/parameter-table/ChildBodyParametersRows.module.scss @@ -0,0 +1,21 @@ +.childBodyParametersRows { + details tr { + border-top: none; + } + + // Remove any default markdown article padding for property cells + details tr td { + padding-bottom: 0.25rem; + } + + // Set the left border for in the nested property tables. Also need to override + // a default markdown file style that sets a table's font size based on + // percentage which would cause the table font size to shrink more and more + // as the properties nested more and more. + td { + table { + border-left: 4px solid var(--color-border-muted); + font-size: inherit !important; + } + } +} diff --git a/components/rest/ChildBodyParametersRows.tsx b/components/parameter-table/ChildBodyParametersRows.tsx similarity index 63% rename from components/rest/ChildBodyParametersRows.tsx rename to components/parameter-table/ChildBodyParametersRows.tsx index 959fb45ed5..6684846f4b 100644 --- a/components/rest/ChildBodyParametersRows.tsx +++ b/components/parameter-table/ChildBodyParametersRows.tsx @@ -1,7 +1,11 @@ +import cx from 'classnames' + import { useTranslation } from 'components/hooks/useTranslation' import { ParameterRow } from './ParameterRow' import type { ChildParameter } from './types' +import styles from './ChildBodyParametersRows.module.scss' + type Props = { slug: string childParamsGroups: ChildParameter[] @@ -15,27 +19,23 @@ export function ChildBodyParametersRows({ parentType, childParamsGroups, }: Props) { - const { t } = useTranslation('products') + const { t } = useTranslation(['parameter_table', 'products']) return ( - + -
-