Skip to content

Commit

Permalink
feat: keep the form header always visible
Browse files Browse the repository at this point in the history
fixes #11
  • Loading branch information
danielo515 committed Sep 14, 2023
1 parent 0586068 commit 216d9b4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/views/EditFormView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class EditFormView extends ItemView {

async onOpen() {
this.formEditor = new FormEditor({
target: this.contentEl,
target: this.containerEl,
props: {
definition: this.formState,
app: this.app,
Expand Down
33 changes: 24 additions & 9 deletions src/views/FormBuilder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
};
</script>

<div class="flex column gap2">
<div class="flex column gap2 wrapper modal-form">
<form on:submit|preventDefault={handleSubmit}>
<fieldset class="flex column gap2">
<fieldset class="flex column gap2 header">
<label for="name">Form unique name</label>
<span class="hint"
>This name will identify this form uniquely, and will be the
Expand Down Expand Up @@ -134,9 +134,9 @@
</div>
</fieldset>

<h3>Fields</h3>
{#if definition.fields.length > 0}
<fieldset class="flex column gap2 p-2">
<fieldset class="flex column gap2 fields">
<h3>Fields</h3>
{#if definition.fields.length > 0}
{#each definition.fields as field, index}
{@const desc_id = `desc_${index}`}
{@const delete_id = `delete_${index}`}
Expand Down Expand Up @@ -346,14 +346,29 @@
</div>
<hr />
{/each}
</fieldset>
{:else}
No fields yet
{/if}
{:else}
No fields yet
{/if}
</fieldset>
</form>
</div>

<style>
.wrapper,
form {
max-height: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.header {
box-shadow: var(--shadow-bottom) var(--divider-color);
padding: 1rem;
}
.fields {
overflow-y: auto;
padding: 1rem;
}
.flex {
display: flex;
}
Expand Down
1 change: 0 additions & 1 deletion src/views/ManageFormsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class ManageFormsView extends ItemView {
new Setting(row)
.setName(form.title)
.then((setting) => {
console.log(setting)
// This moves the separator of the settings container from he top to the bottom
setting.settingEl.setCssStyles({ borderTop: 'none', borderBottom: '1px solid var(--background-modifier-border)' })
})
Expand Down
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ If your plugin does not need CSS, delete this file.
.modal-form-hint {
color: var(--text-muted);
}
.modal-form {
--shadow-bottom: 0 0.8rem 0.8rem -0.8rem;
}
/* .modal-form-hint code {
color: var(--text-normal);
background-color: var(--background-secondary);
Expand Down

0 comments on commit 216d9b4

Please sign in to comment.