2020-01-22 13:00:20 +01:00
|
|
|
<script>
|
|
|
|
import InputGroup from '../common/Inputs/InputGroup.svelte';
|
|
|
|
|
2020-01-28 22:17:04 +01:00
|
|
|
export let onStyleChanged = () => {};
|
|
|
|
export let componentInfo;
|
2020-01-22 13:00:20 +01:00
|
|
|
|
|
|
|
const tbrl = [
|
|
|
|
{ placeholder: 'T' },
|
|
|
|
{ placeholder: 'R' },
|
|
|
|
{ placeholder: 'B' },
|
|
|
|
{ placeholder: 'L' }
|
|
|
|
];
|
|
|
|
|
|
|
|
const se = [
|
|
|
|
{ placeholder: 'START' },
|
|
|
|
{ placeholder: 'END' },
|
|
|
|
]
|
|
|
|
|
|
|
|
const single = [{ placeholder: '' }];
|
2020-01-28 22:17:04 +01:00
|
|
|
|
|
|
|
|
2020-01-31 17:01:58 +01:00
|
|
|
$: layout = { ...componentInfo._styles.position, ...componentInfo._styles.layout };
|
|
|
|
|
|
|
|
$: layouts = {
|
|
|
|
templaterows: ['Grid Rows', single],
|
|
|
|
templatecolumns: ['Grid Columns', single],
|
|
|
|
};
|
2020-01-28 22:17:04 +01:00
|
|
|
|
|
|
|
$: positions = {
|
|
|
|
column: ['Column', se],
|
|
|
|
row: ['Row', se],
|
|
|
|
};
|
|
|
|
|
|
|
|
$: spacing = {
|
|
|
|
margin: ['Margin', tbrl, 'small'],
|
|
|
|
padding: ['Padding', tbrl, 'small']
|
|
|
|
};
|
|
|
|
|
|
|
|
$: zindex = {
|
|
|
|
zindex: ['Z-Index', single]
|
|
|
|
}
|
|
|
|
|
|
|
|
const newValue = n => Array(n).fill('');
|
2020-01-22 13:00:20 +01:00
|
|
|
</script>
|
2020-01-22 12:21:42 +01:00
|
|
|
|
|
|
|
|
2020-01-31 17:01:58 +01:00
|
|
|
<h3>Styles</h3>
|
2020-01-22 12:21:42 +01:00
|
|
|
|
|
|
|
<h4>Positioning</h4>
|
2020-01-31 17:01:58 +01:00
|
|
|
<div class="layout-pos">
|
|
|
|
{#each Object.entries(layouts) as [key, [name, meta, size]]}
|
|
|
|
<div class="grid">
|
|
|
|
<h5>{name}:</h5>
|
|
|
|
<InputGroup onStyleChanged={_value => onStyleChanged('layout',key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size}
|
|
|
|
type="text"/>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2020-01-22 12:21:42 +01:00
|
|
|
|
2020-01-31 17:01:58 +01:00
|
|
|
<h4>Positioning</h4>
|
2020-01-22 12:21:42 +01:00
|
|
|
<div class="layout-pos">
|
2020-01-28 22:17:04 +01:00
|
|
|
{#each Object.entries(positions) as [key, [name, meta, size]]}
|
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
|
|
|
<InputGroup onStyleChanged={_value => onStyleChanged('position',key, _value)}
|
2020-01-28 22:17:04 +01:00
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size} />
|
|
|
|
</div>
|
|
|
|
{/each}
|
2020-01-22 12:21:42 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<h4>Spacing</h4>
|
|
|
|
<div class="layout-spacing">
|
2020-01-28 22:17:04 +01:00
|
|
|
{#each Object.entries(spacing) as [key, [name, meta, size]]}
|
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
|
|
|
<InputGroup onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
2020-01-28 22:17:04 +01:00
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size} />
|
|
|
|
</div>
|
|
|
|
{/each}
|
2020-01-22 12:21:42 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<h4>Z-Index</h4>
|
|
|
|
<div class="layout-layer">
|
2020-01-28 22:17:04 +01:00
|
|
|
{#each Object.entries(zindex) as [key, [name, meta, size]]}
|
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
|
|
|
<InputGroup onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
2020-01-28 22:17:04 +01:00
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size} />
|
|
|
|
</div>
|
|
|
|
{/each}
|
2020-01-22 12:21:42 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
h3 {
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #8997ab;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-size: 10px;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #163057;
|
|
|
|
opacity: 0.3;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h5 {
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #163057;
|
|
|
|
opacity: 0.6;
|
|
|
|
padding-top: 12px;
|
2020-01-22 13:00:20 +01:00
|
|
|
margin-bottom: 0;
|
2020-01-22 12:21:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
div > div {
|
|
|
|
display: grid;
|
|
|
|
grid-template-rows: 1fr;
|
|
|
|
grid-gap: 10px;
|
|
|
|
height: 40px;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.grid {
|
|
|
|
grid-template-columns: 70px 1fr;
|
|
|
|
}
|
|
|
|
</style>
|