From bc88df98ee777837c2403583984b8880305fc19f Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 9 Feb 2023 13:32:34 +0100 Subject: [PATCH] #505 - Data view theming --- .../components/Common/Button.tsx | 2 +- .../components/DataView/DataForm.tsx | 6 ++- .../components/DataView/DataFormControls.tsx | 4 +- .../components/DataView/DataView.tsx | 51 ++++++++++++++----- .../components/DataView/EmptyView.tsx | 9 ++-- .../components/DataView/SortableContainer.tsx | 22 +++++--- .../components/DataView/SortableItem.tsx | 27 +++++++--- .../components/Layout/NavigationItem.tsx | 22 ++++---- src/dashboardWebView/index.tsx | 20 ++++++-- 9 files changed, 114 insertions(+), 49 deletions(-) diff --git a/src/dashboardWebView/components/Common/Button.tsx b/src/dashboardWebView/components/Common/Button.tsx index 4fc5b04f..4b494b4f 100644 --- a/src/dashboardWebView/components/Common/Button.tsx +++ b/src/dashboardWebView/components/Common/Button.tsx @@ -27,7 +27,7 @@ export const Button: React.FunctionComponent = ({ ) } ${secondary ? getColors(`bg-red-300 hover:bg-red-400`, `bg-[var(--vscode-button-secondaryBackground)] text-[--vscode-button-secondaryForeground] hover:bg-[var(--vscode-button-secondaryHoverBackground)]`) : - getColors(`bg-teal-600 hover:bg-teal-700`, `bg-[var(--frontmatter-button-background)] text-[--vscode-button-foreground] hover:bg-[var(--frontmatter-button-hoverBackground)]`) + getColors(`bg-teal-600 hover:bg-teal-700`, `bg-[var(--frontmatter-button-background)] text-[var(--vscode-button-foreground)] hover:bg-[var(--frontmatter-button-hoverBackground)]`) } `} onClick={onClick} diff --git a/src/dashboardWebView/components/DataView/DataForm.tsx b/src/dashboardWebView/components/DataView/DataForm.tsx index 91e1d44f..1a484a6e 100644 --- a/src/dashboardWebView/components/DataView/DataForm.tsx +++ b/src/dashboardWebView/components/DataView/DataForm.tsx @@ -6,6 +6,7 @@ import { AutoFields, AutoForm, ErrorsField } from '../../../components/uniforms- // import { AutoFields, AutoForm, ErrorsField } from 'uniforms-antd'; import { ErrorBoundary } from '@sentry/react'; import { DataFormControls } from './DataFormControls'; +import useThemeColors from '../../hooks/useThemeColors'; export interface IDataFormProps { schema: any; @@ -21,6 +22,7 @@ export const DataForm: React.FunctionComponent = ({ onClear }: React.PropsWithChildren) => { const [bridge, setBridge] = useState(null); + const { getColors } = useThemeColors(); const ajv = new Ajv({ allErrors: true, useDefaults: true }); @@ -47,9 +49,9 @@ export const DataForm: React.FunctionComponent = ({
{model ? ( -

Modify the data

+

Modify the data

) : ( -

Add new data

+

Add new data

)} = onClear }: React.PropsWithChildren) => { const { formRef } = useForm(); + const { getColors } = useThemeColors(); return ( -
+