Add svelte as a view engine to swaf #33

Merged
ashpie merged 97 commits from svelte into develop 2021-11-09 19:31:22 +01:00
Showing only changes of commit 93be06d10f - Show all commits

View File

@ -11,6 +11,8 @@
export let submitText: string; export let submitText: string;
export let submitIcon: string; export let submitIcon: string;
export let submitClass: string = undefined; export let submitClass: string = undefined;
export let isBoldSubmit: boolean = true;
export let resetButton: boolean = false;
export let confirm: string = undefined; export let confirm: string = undefined;
const formId = nextAvailableFormId++; const formId = nextAvailableFormId++;
@ -23,17 +25,35 @@
} }
</script> </script>
<style lang="scss">
.form-controls {
display: flex;
justify-content: space-between;
> :last-child:not(* + :last-child) {
margin-left: auto;
margin-right: auto;
}
}
</style>
<form {action} method="POST" id="{formId}-form" on:submit={handleSubmit}> <form {action} method="POST" id="{formId}-form" on:submit={handleSubmit}>
<CsrfTokenField/> <CsrfTokenField/>
<slot/> <slot/>
<button type="submit" class={submitClass}> <div class="form-controls">
{#if submitIcon} {#if resetButton}
<Icon name={submitIcon}/> <button type="reset"><Icon name="trash"/>Reset</button>
{/if} {/if}
{#if button}
<span class="tip">{submitText}</span> <button type="submit" class={submitClass} class:bold={isBoldSubmit}>
{:else} {#if submitIcon}
{submitText} <Icon name={submitIcon}/>
{/if} {/if}
</button> {#if button}
<span class="tip">{submitText}</span>
{:else}
{submitText}
{/if}
</button>
</div>
</form> </form>