|
|
|
@ -30,46 +30,32 @@ |
|
|
|
{#if schemaFields.length} |
|
|
|
<div class="schema-fields"> |
|
|
|
{#each schemaFields as [field, schema]} |
|
|
|
<div class="capitalise"> |
|
|
|
{#if schemaHasOptions(schema)} |
|
|
|
<div class="field-label">{field}</div> |
|
|
|
<Select thin secondary bind:value={value[field]}> |
|
|
|
<option value="">Choose an option</option> |
|
|
|
{#each schema.constraints.inclusion as option} |
|
|
|
<option value={option}>{option}</option> |
|
|
|
{/each} |
|
|
|
</Select> |
|
|
|
{:else if schema.type === 'string' || schema.type === 'number'} |
|
|
|
<BindableInput |
|
|
|
thin |
|
|
|
bind:value={value[field]} |
|
|
|
label={field} |
|
|
|
type="string" |
|
|
|
{bindings} /> |
|
|
|
{/if} |
|
|
|
</div> |
|
|
|
{#if schemaHasOptions(schema)} |
|
|
|
<Select label={field} thin secondary bind:value={value[field]}> |
|
|
|
<option value="">Choose an option</option> |
|
|
|
{#each schema.constraints.inclusion as option} |
|
|
|
<option value={option}>{option}</option> |
|
|
|
{/each} |
|
|
|
</Select> |
|
|
|
{:else if schema.type === 'string' || schema.type === 'number'} |
|
|
|
<BindableInput |
|
|
|
thin |
|
|
|
bind:value={value[field]} |
|
|
|
label={field} |
|
|
|
type="string" |
|
|
|
{bindings} /> |
|
|
|
{/if} |
|
|
|
{/each} |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
|
|
|
|
<style> |
|
|
|
.field-label { |
|
|
|
color: var(--ink); |
|
|
|
margin-bottom: 12px; |
|
|
|
display: flex; |
|
|
|
font-size: 14px; |
|
|
|
font-weight: 500; |
|
|
|
font-family: sans-serif; |
|
|
|
} |
|
|
|
|
|
|
|
.capitalise :global(label), |
|
|
|
.field-label { |
|
|
|
text-transform: capitalize; |
|
|
|
} |
|
|
|
|
|
|
|
.schema-fields { |
|
|
|
display: grid; |
|
|
|
grid-gap: var(--spacing-xl); |
|
|
|
margin-top: var(--spacing-xl); |
|
|
|
} |
|
|
|
.schema-fields :global(label) { |
|
|
|
text-transform: capitalize; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|