From e7d1ed3114cf5bf13ff0dc0228eefaea8700881d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 3 Sep 2021 11:50:09 +0100 Subject: [PATCH] Add custom theming for primary color and primary hover color to form components --- packages/bbui/src/Form/Core/DatePicker.svelte | 2 + packages/bbui/src/Form/DatePicker.svelte | 2 + .../design/AppPreview/ThemeEditor.svelte | 2 + .../client/src/components/ClientApp.svelte | 53 ++--------- .../src/components/CustomThemeWrapper.svelte | 87 +++++++++++++++++++ .../client/src/components/app/Layout.svelte | 2 +- .../components/app/forms/DateTimeField.svelte | 1 + 7 files changed, 103 insertions(+), 46 deletions(-) create mode 100644 packages/client/src/components/CustomThemeWrapper.svelte diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index 44b77e0bbe..18c93b6c5c 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -13,6 +13,7 @@ export let enableTime = true export let value = null export let placeholder = null + export let appendTo = null const dispatch = createEventDispatcher() const flatpickrId = `${generateID()}-wrapper` @@ -24,6 +25,7 @@ altInput: true, altFormat: enableTime ? "F j Y, H:i" : "F j, Y", wrap: true, + appendTo, } const handleChange = event => { diff --git a/packages/bbui/src/Form/DatePicker.svelte b/packages/bbui/src/Form/DatePicker.svelte index 9e0c40b11d..aff7ddc1c5 100644 --- a/packages/bbui/src/Form/DatePicker.svelte +++ b/packages/bbui/src/Form/DatePicker.svelte @@ -10,6 +10,7 @@ export let error = null export let enableTime = true export let placeholder = null + export let appendTo = null const dispatch = createEventDispatcher() const onChange = e => { @@ -26,6 +27,7 @@ {value} {placeholder} {enableTime} + {appendTo} on:change={onChange} /> diff --git a/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte b/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte index 6ea82e2713..f1ac16ee02 100644 --- a/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte +++ b/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte @@ -41,6 +41,7 @@
@@ -48,6 +49,7 @@
-
- {#key $screenStore.activeLayout._id} - - {/key} -
+ +
+ {#key $screenStore.activeLayout._id} + + {/key} +
+
@@ -132,42 +131,6 @@ #app-root.preview { border: 1px solid var(--spectrum-global-color-gray-300); } - - #app-root { - /* Primary */ - --spectrum-global-color-blue-600: var(--primaryColor); - --spectrum-global-color-blue-700: var(--primaryColor); - --spectrum-global-color-static-blue-600: var(--primaryColor); - --spectrum-global-color-static-blue-700: var(--primaryColor); - - /* Primary hover */ - --spectrum-global-color-blue-400: var(--primaryColorHover); - --spectrum-global-color-blue-500: var(--primaryColorHover); - --spectrum-global-color-static-blue-400: var(--primaryColorHover); - --spectrum-global-color-static-blue-500: var(--primaryColorHover); - } - - /* Custom scrollbars */ - :global(::-webkit-scrollbar) { - width: 8px; - height: 8px; - } - :global(::-webkit-scrollbar-track) { - background: var(--spectrum-alias-background-color-default); - } - :global(::-webkit-scrollbar-thumb) { - background-color: var(--spectrum-global-color-gray-400); - border-radius: 4px; - } - :global(::-webkit-scrollbar-corner) { - background: var(--spectrum-alias-background-color-default); - } - :global(*) { - scrollbar-width: thin; - scrollbar-color: var(--spectrum-global-color-gray-400) - var(--spectrum-alias-background-color-default); - } - .error { position: absolute; width: 100%; diff --git a/packages/client/src/components/CustomThemeWrapper.svelte b/packages/client/src/components/CustomThemeWrapper.svelte new file mode 100644 index 0000000000..e56247f88c --- /dev/null +++ b/packages/client/src/components/CustomThemeWrapper.svelte @@ -0,0 +1,87 @@ + + +
+ +
+ + diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index 75b6f0cbc0..64a5599124 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -248,7 +248,7 @@ transition: color 130ms ease-out; } .link:hover { - color: var(--spectrum-global-color-blue-600); + color: var(--spectrum-link-primary-m-text-color-hover); } .close { display: none; diff --git a/packages/client/src/components/app/forms/DateTimeField.svelte b/packages/client/src/components/app/forms/DateTimeField.svelte index 534bb5c0a4..9bbfabaee9 100644 --- a/packages/client/src/components/app/forms/DateTimeField.svelte +++ b/packages/client/src/components/app/forms/DateTimeField.svelte @@ -56,6 +56,7 @@ disabled={fieldState.disabled} error={fieldState.error} id={fieldState.fieldId} + appendTo={document.getElementById("app-root")} {enableTime} {placeholder} />