icons instead of text
This commit is contained in:
parent
f69c992e7a
commit
660872abc0
|
@ -29,6 +29,18 @@ const css_map = {
|
|||
name: "grid-template-columns",
|
||||
generate: self,
|
||||
},
|
||||
align: {
|
||||
name: "align-items",
|
||||
generate: self,
|
||||
},
|
||||
justify: {
|
||||
name: "justify-content",
|
||||
generate: self,
|
||||
},
|
||||
direction: {
|
||||
name: "flex-direction",
|
||||
generate: self
|
||||
},
|
||||
gridarea: {
|
||||
name: "grid-area",
|
||||
generate: make_margin,
|
||||
|
@ -90,6 +102,12 @@ const handle_grid = (acc, [name, value]) => {
|
|||
return acc.concat([[name, value]])
|
||||
}
|
||||
|
||||
// const handleFlex = (acc, [name, value]) => {
|
||||
// if (name === "align-items" || name === "justify-content") {
|
||||
// return acc.concat([name, value])
|
||||
// }
|
||||
// };
|
||||
|
||||
const object_to_css_string = [
|
||||
toPairs,
|
||||
reduce(handle_grid, []),
|
||||
|
@ -100,7 +118,9 @@ const object_to_css_string = [
|
|||
|
||||
export const generate_css = ({ layout, position }) => {
|
||||
let _layout = pipe(layout, object_to_css_string)
|
||||
_layout = _layout.length ? _layout + "\ndisplay: grid;" : _layout
|
||||
if (_layout.length) {
|
||||
_layout += `\ndisplay: ${_layout.includes("flex") ? "flex" : "grid"};`;
|
||||
}
|
||||
|
||||
return {
|
||||
layout: _layout,
|
||||
|
|
|
@ -5,7 +5,6 @@ export const store = getStore()
|
|||
|
||||
export const initialise = async () => {
|
||||
try {
|
||||
console.log(process.env.NODE_ENV);
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
LogRocket.init("knlald/budibase");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<title>Budibase Builder</title>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
|
||||
<link rel='icon' type='image/png' href='/_builder/favicon.png'>
|
||||
<link rel='stylesheet' href='/_builder/global.css'>
|
||||
<link rel='stylesheet' href='/_builder/codemirror.css'>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
$store.currentFrontEndType === "page"
|
||||
? getProps($store.currentPreviewItem, ["name", "favicon"])
|
||||
: getProps($store.currentPreviewItem, ["name", "description", "route"])
|
||||
$: console.log(screen_props)
|
||||
|
||||
const onPropChanged = store.setComponentProp
|
||||
const onStyleChanged = store.setComponentStyle
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
import InputGroup from "../common/Inputs/InputGroup.svelte"
|
||||
import LayoutTemplateControls from "./LayoutTemplateControls.svelte";
|
||||
|
||||
export let onStyleChanged = () => {}
|
||||
export let component
|
||||
|
@ -25,6 +26,12 @@
|
|||
templatecolumns: ["Grid Columns", single],
|
||||
}
|
||||
|
||||
$: display = {
|
||||
direction: ["Direction", single],
|
||||
align: ["Align", single],
|
||||
justify: ["Justify", single],
|
||||
}
|
||||
|
||||
$: positions = {
|
||||
column: ["Column", se],
|
||||
row: ["Row", se],
|
||||
|
@ -49,22 +56,24 @@
|
|||
|
||||
<h3>Styles</h3>
|
||||
|
||||
<h4>Positioning</h4>
|
||||
<h4>Display</h4>
|
||||
<div class="layout-pos">
|
||||
{#each Object.entries(layouts) as [key, [name, meta, size]] (component._id + key)}
|
||||
{#each Object.entries(display) as [key, [name, meta, size]] (component._id + key)}
|
||||
<div class="grid">
|
||||
<h5>{name}:</h5>
|
||||
<InputGroup
|
||||
<LayoutTemplateControls
|
||||
onStyleChanged={_value => onStyleChanged('layout', key, _value)}
|
||||
values={layout[key] || newValue(meta.length)}
|
||||
propertyName={name}
|
||||
{meta}
|
||||
{size}
|
||||
type="text" />
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<h4>Positioning</h4>
|
||||
<!-- <h4>Positioning</h4>
|
||||
<div class="layout-pos">
|
||||
{#each Object.entries(positions) as [key, [name, meta, size]] (component._id + key)}
|
||||
<div class="grid">
|
||||
|
@ -76,7 +85,7 @@
|
|||
{size} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<h4>Spacing</h4>
|
||||
<div class="layout-spacing">
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
<script>
|
||||
import PlusButton from "../common/PlusButton.svelte"
|
||||
|
||||
export let meta = []
|
||||
export let size = ""
|
||||
export let values = []
|
||||
export let propertyName
|
||||
export let onStyleChanged = () => {}
|
||||
|
||||
let _values = values.map(v => v)
|
||||
|
||||
$: onStyleChanged(_values)
|
||||
|
||||
const PROPERTY_OPTIONS = {
|
||||
Direction: {
|
||||
vertical: ["column", "ri-layout-column-line"],
|
||||
horizontal: ["row", "ri-layout-row-line"],
|
||||
},
|
||||
Align: {
|
||||
left: ["flex-start", "ri-align-left"],
|
||||
center: ["center", "ri-align-center"],
|
||||
right: ["flex-end", "ri-align-right"],
|
||||
space: ["space-between", "ri-space"],
|
||||
},
|
||||
Justify: {
|
||||
left: ["flex-start", "ri-align-left"],
|
||||
center: ["center", "ri-align-center"],
|
||||
right: ["flex-end", "ri-align-right"],
|
||||
space: ["space-between", "ri-space"],
|
||||
},
|
||||
}
|
||||
|
||||
$: propertyChoices = Object.entries(PROPERTY_OPTIONS[propertyName])
|
||||
</script>
|
||||
|
||||
<div class="inputs {size}">
|
||||
{#each meta as { placeholder }, i}
|
||||
{#each propertyChoices as [displayName, [cssPropValue, icon]]}
|
||||
<button
|
||||
class:selected={cssPropValue === _values[i]}
|
||||
on:click={() => {
|
||||
const newPropertyValue = cssPropValue === _values[i] ? '' : cssPropValue
|
||||
_values[i] = newPropertyValue
|
||||
}}>
|
||||
<i class={icon} />
|
||||
</button>
|
||||
{/each}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.selected {
|
||||
color: var(--button-text);
|
||||
background: var(--background-button);
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
|
||||
min-width: 1.8rem;
|
||||
min-height: 1.8rem;
|
||||
padding-bottom: 10px;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
color: rgba(22, 48, 87, 1);
|
||||
}
|
||||
|
||||
.inputs {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue