Merge pull request #2354 from Budibase/joe-tweaks

Some tweaks for Joe
This commit is contained in:
Andrew Kingston 2021-08-13 14:08:56 +01:00 committed by GitHub
commit 2b6fa5cfbf
6 changed files with 61 additions and 14 deletions

View File

@ -19,7 +19,7 @@
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const categories = [ const categories = [
{ {
label: "Grays", label: "Theme",
colors: [ colors: [
"gray-50", "gray-50",
"gray-75", "gray-75",
@ -72,6 +72,9 @@
"blue-700", "blue-700",
"indigo-700", "indigo-700",
"magenta-700", "magenta-700",
"static-white",
"static-black",
], ],
}, },
] ]
@ -101,10 +104,20 @@
} }
const getCheckColor = value => { const getCheckColor = value => {
return /^.*(white|(gray-(50|75|100|200|300|400|500)))\)$/.test(value) // Use dynamic color for theme grays
if (value?.includes("gray")) {
return /^.*(gray-(50|75|100|200|300|400|500))\)$/.test(value)
? "var(--spectrum-global-color-gray-900)" ? "var(--spectrum-global-color-gray-900)"
: "var(--spectrum-global-color-gray-50)" : "var(--spectrum-global-color-gray-50)"
} }
// Use black check for static white
if (value?.includes("static-black")) {
return "var(--spectrum-global-color-static-gray-50)"
}
return "var(--spectrum-global-color-static-gray-900)"
}
</script> </script>
<div class="container"> <div class="container">

View File

@ -14,6 +14,7 @@ export const margin = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -34,6 +35,7 @@ export const margin = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -54,6 +56,7 @@ export const margin = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -74,6 +77,7 @@ export const margin = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -101,6 +105,7 @@ export const padding = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -121,6 +126,7 @@ export const padding = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -141,6 +147,7 @@ export const padding = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },
@ -161,6 +168,7 @@ export const padding = {
options: [ options: [
{ label: "4px", value: "4px" }, { label: "4px", value: "4px" },
{ label: "8px", value: "8px" }, { label: "8px", value: "8px" },
{ label: "12px", value: "12px" },
{ label: "16px", value: "16px" }, { label: "16px", value: "16px" },
{ label: "20px", value: "20px" }, { label: "20px", value: "20px" },
{ label: "32px", value: "32px" }, { label: "32px", value: "32px" },

View File

@ -268,6 +268,10 @@
{ {
"label": "Warning", "label": "Warning",
"value": "warning" "value": "warning"
},
{
"label": "Over Background",
"value": "overBackground"
} }
], ],
"defaultValue": "primary" "defaultValue": "primary"
@ -596,6 +600,9 @@
"showInBar": true, "showInBar": true,
"barStyle": "picker", "barStyle": "picker",
"options": [{ "options": [{
"label": "Extra Small",
"value": "XS"
}, {
"label": "Small", "label": "Small",
"value": "S" "value": "S"
}, { }, {
@ -604,6 +611,15 @@
}, { }, {
"label": "Large", "label": "Large",
"value": "L" "value": "L"
}, {
"label": "Extra Large",
"value": "XL"
}, {
"label": "2XL",
"value": "XXL"
}, {
"label": "3XL",
"value": "XXXL"
}] }]
}, },
{ {
@ -690,6 +706,9 @@
"showInBar": true, "showInBar": true,
"barStyle": "picker", "barStyle": "picker",
"options": [{ "options": [{
"label": "Extra Small",
"value": "XS"
}, {
"label": "Small", "label": "Small",
"value": "S" "value": "S"
}, { }, {
@ -698,6 +717,15 @@
}, { }, {
"label": "Large", "label": "Large",
"value": "L" "value": "L"
}, {
"label": "Extra Large",
"value": "XL"
}, {
"label": "2XL",
"value": "XXL"
}, {
"label": "3XL",
"value": "XXXL"
}] }]
}, },
{ {

View File

@ -34,6 +34,7 @@
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.105-alpha.8", "@budibase/bbui": "^0.9.105-alpha.8",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",
"@spectrum-css/link": "^3.1.3", "@spectrum-css/link": "^3.1.3",

View File

@ -1,5 +1,6 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import "@spectrum-css/button/dist/index-vars.css"
const { styleable } = getContext("sdk") const { styleable } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -27,4 +28,7 @@
width: fit-content; width: fit-content;
width: -moz-fit-content; width: -moz-fit-content;
} }
.spectrum-Button--overBackground:hover {
color: #555;
}
</style> </style>

View File

@ -16,6 +16,8 @@
$: componentText = $builderStore.inBuilder $: componentText = $builderStore.inBuilder
? text || $component.name || "Placeholder text" ? text || $component.name || "Placeholder text"
: text || "" : text || ""
$: sizeClass = `spectrum-Body--size${size || "M"}`
$: alignClass = `align--${align || "left"}`
// Add color styles to main styles object, otherwise the styleable helper // Add color styles to main styles object, otherwise the styleable helper
// overrides the color when it's passed as inline style. // overrides the color when it's passed as inline style.
@ -41,7 +43,7 @@
class:bold class:bold
class:italic class:italic
class:underline class:underline
class="align--{align || 'left'} size--{size || 'M'}" class="spectrum-Body {sizeClass} {alignClass}"
> >
{componentText} {componentText}
</p> </p>
@ -65,15 +67,6 @@
.underline { .underline {
text-decoration: underline; text-decoration: underline;
} }
.size--S {
font-size: 14px;
}
.size--M {
font-size: 16px;
}
.size--L {
font-size: 18px;
}
.align--left { .align--left {
text-align: left; text-align: left;
} }