Begin implementation of components panel.
This commit is contained in:
parent
8ef407f44e
commit
9fdcac7c41
|
@ -4,10 +4,10 @@ import ComponentsList from "./ComponentsList.svelte";
|
||||||
|
|
||||||
let selected="properties";
|
let selected="properties";
|
||||||
|
|
||||||
const isSelected = tab =>
|
const isSelected = tab =>
|
||||||
selected === tab;
|
selected === tab;
|
||||||
|
|
||||||
const selectTab = tab =>
|
const selectTab = tab =>
|
||||||
selected = tab;
|
selected = tab;
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ const selectTab = tab =>
|
||||||
|
|
||||||
<div class="switcher">
|
<div class="switcher">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class:selected={selected==="properties"}
|
class:selected={selected==="properties"}
|
||||||
on:click={() => selectTab("properties")}>
|
on:click={() => selectTab("properties")}>
|
||||||
Properties
|
Properties
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class:selected={selected==="components"}
|
class:selected={selected==="components"}
|
||||||
on:click={() => selectTab("components")}>
|
on:click={() => selectTab("components")}>
|
||||||
Components
|
Components
|
||||||
|
@ -50,24 +50,28 @@ const selectTab = tab =>
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
padding: 2rem 1.5rem 2rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switcher {
|
.switcher {
|
||||||
flex: 0 0 auto;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switcher > button {
|
.switcher > button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: rgba(0,0,0,0);
|
border: none;
|
||||||
border-style: solid;
|
|
||||||
border-color: var(--slate);
|
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switcher > .selected {
|
.switcher > .selected {
|
||||||
background-color: red;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
|
@ -76,4 +80,4 @@ const selectTab = tab =>
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,8 +13,8 @@ import {
|
||||||
import Button from "../common/Button.svelte";
|
import Button from "../common/Button.svelte";
|
||||||
import ButtonGroup from "../common/ButtonGroup.svelte";
|
import ButtonGroup from "../common/ButtonGroup.svelte";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
cloneDeep,
|
cloneDeep,
|
||||||
join,
|
join,
|
||||||
split,
|
split,
|
||||||
map,
|
map,
|
||||||
|
@ -95,15 +95,15 @@ const updateComponent = doChange => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPropsChanged = newProps => {
|
const onPropsChanged = newProps => {
|
||||||
updateComponent(newComponent =>
|
updateComponent(newComponent =>
|
||||||
assign(newComponent.props, newProps));
|
assign(newComponent.props, newProps));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const validate = () => {
|
const validate = () => {
|
||||||
const fieldInvalid = (field, err) =>
|
const fieldInvalid = (field, err) =>
|
||||||
errors[field] = err;
|
errors[field] = err;
|
||||||
const fieldValid = field =>
|
const fieldValid = field =>
|
||||||
errors[field] && delete errors[field];
|
errors[field] && delete errors[field];
|
||||||
|
|
||||||
if(!name) nameInvalid = "component name i not supplied";
|
if(!name) nameInvalid = "component name i not supplied";
|
||||||
|
@ -127,12 +127,12 @@ const showDialog = () => {
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div>{shortName}</div>
|
<div>{shortName}</div>
|
||||||
<div>
|
<div>
|
||||||
<IconButton icon="save"
|
<IconButton icon="save"
|
||||||
on:click={save}
|
on:click={save}
|
||||||
color="var(--secondary100)"
|
color="var(--secondary100)"
|
||||||
hoverColor="var(--primary100)"/>
|
hoverColor="var(--primary100)"/>
|
||||||
<IconButton icon="trash"
|
<IconButton icon="trash"
|
||||||
on:click={deleteComponent}
|
on:click={deleteComponent}
|
||||||
color="var(--secondary100)"
|
color="var(--secondary100)"
|
||||||
hoverColor="var(--primary100)"/>
|
hoverColor="var(--primary100)"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -140,11 +140,11 @@ const showDialog = () => {
|
||||||
|
|
||||||
<div class="component-props-container">
|
<div class="component-props-container">
|
||||||
|
|
||||||
|
|
||||||
<PropsView onValidate={onPropsValidate}
|
<PropsView onValidate={onPropsValidate}
|
||||||
{componentInfo}
|
{componentInfo}
|
||||||
{onPropsChanged} />
|
{onPropsChanged} />
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ const showDialog = () => {
|
||||||
<div class="uk-modal-dialog">
|
<div class="uk-modal-dialog">
|
||||||
|
|
||||||
<div class="uk-modal-header">
|
<div class="uk-modal-header">
|
||||||
Delete {name} ?
|
Delete {name} ?
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-modal-body">
|
<div class="uk-modal-body">
|
||||||
|
@ -164,12 +164,12 @@ const showDialog = () => {
|
||||||
|
|
||||||
<div class="uk-modal-footer">
|
<div class="uk-modal-footer">
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button grouped
|
<Button grouped
|
||||||
on:click={confirmDeleteComponent}>
|
on:click={confirmDeleteComponent}>
|
||||||
OK
|
OK
|
||||||
</Button>
|
</Button>
|
||||||
<Button grouped
|
<Button grouped
|
||||||
on:click={hideDialog}
|
on:click={hideDialog}
|
||||||
color="secondary" >
|
color="secondary" >
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -186,9 +186,7 @@ const showDialog = () => {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-style: solid;
|
|
||||||
border-width: 1px 0 0 0;
|
|
||||||
border-color: var(--slate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
|
@ -213,4 +211,4 @@ const showDialog = () => {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue