mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
add option to hide revert buttons
This commit is contained in:
parent
c74a373cdc
commit
2860e628ee
2 changed files with 8 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
export let choices: Choice<T>[];
|
export let choices: Choice<T>[];
|
||||||
export let disabled: boolean = false;
|
export let disabled: boolean = false;
|
||||||
export let disabledChoices: T[] = [];
|
export let disabledChoices: T[] = [];
|
||||||
|
export let hideRevert: boolean = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row --cols={13}>
|
<Row --cols={13}>
|
||||||
|
|
@ -27,7 +28,9 @@
|
||||||
<Col --col-size={6} {breakpoint}>
|
<Col --col-size={6} {breakpoint}>
|
||||||
<ConfigInput>
|
<ConfigInput>
|
||||||
<EnumSelector bind:value {choices} {disabled} {disabledChoices} />
|
<EnumSelector bind:value {choices} {disabled} {disabledChoices} />
|
||||||
|
{#if !hideRevert}
|
||||||
<RevertButton slot="revert" bind:value {defaultValue} />
|
<RevertButton slot="revert" bind:value {defaultValue} />
|
||||||
|
{/if}
|
||||||
</ConfigInput>
|
</ConfigInput>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
export let value: boolean;
|
export let value: boolean;
|
||||||
export let defaultValue: boolean;
|
export let defaultValue: boolean;
|
||||||
export let disabled: boolean = false;
|
export let disabled: boolean = false;
|
||||||
|
export let hideRevert: boolean = false;
|
||||||
|
|
||||||
const id = Math.random().toString(36).substring(2);
|
const id = Math.random().toString(36).substring(2);
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -22,7 +23,9 @@
|
||||||
<Col --col-justify="flex-end">
|
<Col --col-justify="flex-end">
|
||||||
<ConfigInput grow={false}>
|
<ConfigInput grow={false}>
|
||||||
<Switch {id} bind:value {disabled} />
|
<Switch {id} bind:value {disabled} />
|
||||||
|
{#if !hideRevert}
|
||||||
<RevertButton slot="revert" bind:value {defaultValue} />
|
<RevertButton slot="revert" bind:value {defaultValue} />
|
||||||
|
{/if}
|
||||||
</ConfigInput>
|
</ConfigInput>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue