Fix button theming and add nav text theming

This commit is contained in:
Andrew Kingston 2021-09-06 16:23:12 +01:00
parent 5568ab084b
commit b11deece29
4 changed files with 43 additions and 9 deletions

View File

@ -19,6 +19,7 @@
primaryColorHover: "var(--spectrum-global-color-blue-500)", primaryColorHover: "var(--spectrum-global-color-blue-500)",
buttonBorderRadius: "16px", buttonBorderRadius: "16px",
navBackground: "var(--spectrum-global-color-gray-100)", navBackground: "var(--spectrum-global-color-gray-100)",
navTextColor: "var(--spectrum-global-color-gray-800)",
} }
const buttonBorderRadiusOptions = [ const buttonBorderRadiusOptions = [
@ -93,7 +94,7 @@
/> />
</div> </div>
<div class="setting"> <div class="setting">
<Label size="L">Navigation bar background</Label> <Label size="L">Navigation bar background color</Label>
<ColorPicker <ColorPicker
spectrumTheme={$store.theme} spectrumTheme={$store.theme}
value={$store.customTheme?.navBackground || value={$store.customTheme?.navBackground ||
@ -101,6 +102,14 @@
on:change={updateProperty("navBackground")} on:change={updateProperty("navBackground")}
/> />
</div> </div>
<div class="setting">
<Label size="L">Navigation bar text color</Label>
<ColorPicker
spectrumTheme={$store.theme}
value={$store.customTheme?.navTextColor || defaultTheme.navTextColor}
on:change={updateProperty("navTextColor")}
/>
</div>
</Layout> </Layout>
</ModalContent> </ModalContent>
</Modal> </Modal>
@ -114,7 +123,7 @@
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding-bottom: var(--spectrum-global-dimension-static-size-100); padding-bottom: var(--spectrum-global-dimension-static-size-200);
border-bottom: var(--border-light); border-bottom: var(--border-light);
} }
.setting:last-child { .setting:last-child {

View File

@ -16,7 +16,7 @@
/* Buttons */ /* Buttons */
--spectrum-semantic-cta-color-background-default: var(--primaryColor); --spectrum-semantic-cta-color-background-default: var(--primaryColor);
--spectrum-semantic-cta-color-background-hover: var(--primaryColorHover); --spectrum-semantic-cta-color-background-hover: var(--primaryColorHover);
--spectrum-alias-item-rounded-border-radius-m: var(--buttonBorderRadius); --spectrum-button-primary-m-border-radius: var(--buttonBorderRadius);
/* Loading spinners */ /* Loading spinners */
--spectrum-progresscircle-medium-track-fill-color: var(--primaryColor); --spectrum-progresscircle-medium-track-fill-color: var(--primaryColor);

View File

@ -1,6 +1,7 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { Heading, Icon } from "@budibase/bbui" import { Heading, Icon } from "@budibase/bbui"
import active from "svelte-spa-router/active"
const { routeStore, styleable, linkable, builderStore } = getContext("sdk") const { routeStore, styleable, linkable, builderStore } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -95,7 +96,13 @@
<div class="links" class:visible={mobileOpen}> <div class="links" class:visible={mobileOpen}>
{#each validLinks as { text, url }} {#each validLinks as { text, url }}
{#if isInternal(url)} {#if isInternal(url)}
<a class="link" href={url} use:linkable on:click={close}> <a
class="link"
href={url}
use:linkable
on:click={close}
use:active={url}
>
{text} {text}
</a> </a>
{:else} {:else}
@ -165,6 +172,18 @@
max-width: 100%; max-width: 100%;
gap: var(--spacing-xl); gap: var(--spacing-xl);
} }
.nav :global(.spectrum-Icon) {
color: var(--navTextColor);
opacity: 0.75;
}
.nav :global(.spectrum-Icon:hover) {
color: var(--navTextColor);
opacity: 1;
}
.nav :global(h1) {
color: var(--navTextColor);
}
.nav-header { .nav-header {
flex: 0 0 auto; flex: 0 0 auto;
display: flex; display: flex;
@ -242,13 +261,19 @@
margin-top: var(--spacing-xl); margin-top: var(--spacing-xl);
} }
.link { .link {
color: var(--spectrum-alias-text-color); opacity: 0.75;
color: var(--navTextColor);
font-size: var(--spectrum-global-dimension-font-size-200); font-size: var(--spectrum-global-dimension-font-size-200);
font-weight: 600; font-weight: 600;
transition: color 130ms ease-out; transition: color 130ms ease-out;
} }
.link.active {
opacity: 1;
}
.link:hover { .link:hover {
color: var(--spectrum-link-primary-m-text-color-hover); opacity: 1;
text-decoration: underline;
text-underline-position: under;
} }
.close { .close {
display: none; display: none;
@ -332,7 +357,7 @@
transition: transform 0.26s ease-in-out, opacity 0.26s ease-in-out; transition: transform 0.26s ease-in-out, opacity 0.26s ease-in-out;
height: 100vh; height: 100vh;
opacity: 0; opacity: 0;
background: var(--spectrum-alias-background-color-secondary); background: var(--navBackground);
z-index: 999; z-index: 999;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
@ -346,8 +371,7 @@
.links.visible { .links.visible {
opacity: 1; opacity: 1;
transform: translateX(250px); transform: translateX(250px);
box-shadow: 0 0 80px 20px rgba(0, 0, 0, 0.2); box-shadow: 0 0 80px 20px rgba(0, 0, 0, 0.3);
border-right: 1px solid var(--spectrum-global-color-gray-300);
} }
.mobile-click-handler.visible { .mobile-click-handler.visible {
position: fixed; position: fixed;

View File

@ -11,6 +11,7 @@ const defaultCustomTheme = {
primaryColorHover: "var(--spectrum-glo" + "bal-color-blue-500)", primaryColorHover: "var(--spectrum-glo" + "bal-color-blue-500)",
buttonBorderRadius: "16px", buttonBorderRadius: "16px",
navBackground: "var(--spectrum-glo" + "bal-color-gray-100)", navBackground: "var(--spectrum-glo" + "bal-color-gray-100)",
navTextColor: "var(--spectrum-glo" + "bal-color-gray-800)",
} }
const createThemeStore = () => { const createThemeStore = () => {