2020-05-04 17:07:04 +02:00
|
|
|
<script>
|
|
|
|
import PropertyGroup from "./PropertyGroup.svelte"
|
2020-05-07 15:30:04 +02:00
|
|
|
import FlatButtonGroup from "./FlatButtonGroup.svelte"
|
2020-05-05 11:02:10 +02:00
|
|
|
|
2020-05-04 17:07:04 +02:00
|
|
|
export let panelDefinition = {}
|
|
|
|
export let componentInstance = {}
|
|
|
|
export let componentDefinition = {}
|
2020-05-18 17:32:00 +02:00
|
|
|
export let onStyleChanged = () => {}
|
2020-05-05 15:45:52 +02:00
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
let selectedCategory = "desktop"
|
|
|
|
|
2020-05-18 17:32:00 +02:00
|
|
|
const getProperties = name => panelDefinition[name]
|
2020-05-04 17:07:04 +02:00
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
function onChange(category) {
|
|
|
|
selectedCategory = category
|
|
|
|
}
|
|
|
|
|
|
|
|
const buttonProps = [
|
|
|
|
{ value: "desktop", text: "Desktop" },
|
|
|
|
{ value: "mobile", text: "Mobile" },
|
|
|
|
{ value: "hover", text: "Hover" },
|
|
|
|
{ value: "active", text: "Active" },
|
|
|
|
{ value: "selected", text: "Selected" },
|
|
|
|
]
|
|
|
|
|
2020-05-18 17:32:00 +02:00
|
|
|
$: propertyGroupNames = Object.keys(panelDefinition)
|
2020-05-04 17:07:04 +02:00
|
|
|
</script>
|
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
<div class="design-view-container">
|
|
|
|
|
|
|
|
<div class="design-view-state-categories">
|
|
|
|
<FlatButtonGroup value={selectedCategory} {buttonProps} {onChange} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="design-view-property-groups">
|
|
|
|
{#each propertyGroupNames as groupName}
|
|
|
|
<PropertyGroup
|
|
|
|
name={groupName}
|
|
|
|
properties={getProperties(groupName)}
|
2020-05-18 17:32:00 +02:00
|
|
|
{onStyleChanged}
|
2020-05-07 15:30:04 +02:00
|
|
|
{componentDefinition}
|
|
|
|
{componentInstance} />
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.design-view-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.design-view-state-categories {
|
|
|
|
flex: 0 0 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.design-view-property-groups {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
</style>
|