2020-05-04 17:07:04 +02:00
|
|
|
<script>
|
2020-05-05 15:45:52 +02:00
|
|
|
import { excludeProps } from "./propertyCategories.js"
|
2020-05-07 15:30:04 +02:00
|
|
|
import PropertyControl from "./PropertyControl.svelte"
|
2020-05-08 21:29:15 +02:00
|
|
|
|
2020-05-05 11:02:10 +02:00
|
|
|
export let name = ""
|
2020-05-22 16:30:29 +02:00
|
|
|
export let styleCategory = "normal"
|
2020-05-18 17:32:00 +02:00
|
|
|
export let properties = []
|
2020-05-04 17:07:04 +02:00
|
|
|
export let componentInstance = {}
|
2020-05-18 17:32:00 +02:00
|
|
|
export let onStyleChanged = () => {}
|
2020-05-04 17:07:04 +02:00
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
export let show = false
|
2020-05-04 17:07:04 +02:00
|
|
|
|
2020-05-05 11:02:10 +02:00
|
|
|
const capitalize = name => name[0].toUpperCase() + name.slice(1)
|
2020-05-04 17:07:04 +02:00
|
|
|
|
|
|
|
$: icon = show ? "ri-arrow-down-s-fill" : "ri-arrow-right-s-fill"
|
2020-05-25 16:23:56 +02:00
|
|
|
$: style = componentInstance["_styles"][styleCategory] || {}
|
2020-05-04 17:07:04 +02:00
|
|
|
</script>
|
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
<div class="property-group-container">
|
|
|
|
<div class="property-group-name" on:click={() => (show = !show)}>
|
2020-05-04 17:07:04 +02:00
|
|
|
<div class="icon">
|
|
|
|
<i class={icon} />
|
|
|
|
</div>
|
2020-05-05 11:02:10 +02:00
|
|
|
<div class="name">{capitalize(name)}</div>
|
2020-05-04 17:07:04 +02:00
|
|
|
</div>
|
|
|
|
<div class="property-panel" class:show>
|
2020-05-05 15:45:52 +02:00
|
|
|
|
2020-05-18 17:32:00 +02:00
|
|
|
{#each properties as props}
|
2020-05-07 15:30:04 +02:00
|
|
|
<PropertyControl
|
2020-05-18 17:32:00 +02:00
|
|
|
label={props.label}
|
|
|
|
control={props.control}
|
2020-05-20 12:55:25 +02:00
|
|
|
key={props.key}
|
2020-05-25 16:23:56 +02:00
|
|
|
value={style[props.key]}
|
|
|
|
onChange={(key, value) => onStyleChanged(styleCategory, key, value)}
|
2020-05-20 12:55:25 +02:00
|
|
|
props={{ ...excludeProps(props, ['control', 'label']) }} />
|
2020-05-05 15:45:52 +02:00
|
|
|
{/each}
|
2020-05-04 17:07:04 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.property-group-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
height: auto;
|
2020-05-26 21:44:24 +02:00
|
|
|
background: var(--grey-light);
|
|
|
|
margin: 0px 0px 4px 0px;
|
|
|
|
padding: 8px 12px;
|
|
|
|
justify-content: center;
|
|
|
|
border-radius: 4px;
|
2020-05-04 17:07:04 +02:00
|
|
|
}
|
|
|
|
|
2020-05-05 11:02:10 +02:00
|
|
|
.property-group-name {
|
2020-05-04 17:07:04 +02:00
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
flex-flow: row nowrap;
|
|
|
|
}
|
|
|
|
|
2020-05-05 11:02:10 +02:00
|
|
|
.name {
|
2020-05-04 17:07:04 +02:00
|
|
|
flex: 1;
|
|
|
|
text-align: left;
|
2020-05-07 15:30:04 +02:00
|
|
|
padding-top: 2px;
|
|
|
|
font-size: 14px;
|
|
|
|
font-weight: 500;
|
|
|
|
letter-spacing: 0.14px;
|
2020-05-26 21:44:24 +02:00
|
|
|
color: var(--ink);
|
2020-05-07 15:30:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
flex: 0 0 20px;
|
|
|
|
text-align: center;
|
2020-05-04 17:07:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.property-panel {
|
2020-05-28 17:24:53 +02:00
|
|
|
/* height: 0px;
|
|
|
|
overflow: hidden; */
|
|
|
|
display: none;
|
2020-05-05 15:45:52 +02:00
|
|
|
}
|
|
|
|
|
2020-05-04 17:07:04 +02:00
|
|
|
.show {
|
2020-05-28 17:24:53 +02:00
|
|
|
/* overflow: auto;
|
|
|
|
height: auto; */
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex: 1;
|
2020-05-04 17:07:04 +02:00
|
|
|
}
|
|
|
|
</style>
|