From 46ed7c547db9188023718483ba1849bc79ea572f Mon Sep 17 00:00:00 2001 From: David Lawrence <32286773+david-mk-lawrence@users.noreply.github.com> Date: Tue, 31 Jan 2023 12:09:01 -0800 Subject: [PATCH] adds theme property for background color of nested properties --- src/common-elements/fields-layout.ts | 2 +- .../__snapshots__/DiscriminatorDropdown.test.tsx.snap | 10 ++++++++++ src/theme.ts | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/common-elements/fields-layout.ts b/src/common-elements/fields-layout.ts index 9e7fce0b..0c36e665 100644 --- a/src/common-elements/fields-layout.ts +++ b/src/common-elements/fields-layout.ts @@ -205,6 +205,6 @@ export const PropertiesTable = styled.table` ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} { - background: #ffffff; + background: ${({ theme }) => theme.schema.nestedPropertiesBackground}; } `; diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index 5f865af5..24b82041 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -228,6 +228,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -499,6 +500,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -757,6 +759,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -1077,6 +1080,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -1360,6 +1364,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -1614,6 +1619,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -1893,6 +1899,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -2202,6 +2209,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -2473,6 +2481,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", @@ -2731,6 +2740,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "labelsTextSize": "0.9em", "linesColor": "#7c7cbb", "nestedBackground": "#fafafa", + "nestedPropertiesBackground": "#ffffff", "nestingSpacing": "1em", "requireLabelColor": "#d41f1c", "typeNameColor": "#666", diff --git a/src/theme.ts b/src/theme.ts index 25a91224..39f6dec2 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -96,6 +96,7 @@ const defaultTheme: ThemeInterface = { labelsTextSize: '0.9em', nestingSpacing: '1em', nestedBackground: '#fafafa', + nestedPropertiesBackground: '#ffffff', arrow: { size: '1.1em', color: theme => theme.colors.text.secondary, @@ -306,6 +307,7 @@ export interface ResolvedThemeInterface { labelsTextSize: string; nestingSpacing: string; nestedBackground: string; + nestedPropertiesBackground: string; arrow: { size: string; color: string;