feat: add support to select default radio button based on key
also simplifies the radio button code, making it easier to parse
This commit is contained in:
parent
e1f30ba9a8
commit
446038d37f
2 changed files with 45 additions and 20 deletions
|
@ -5,9 +5,8 @@
|
|||
<p class="subtitle">TIME FORMAT</p>
|
||||
<div class="icons">
|
||||
<RadioButtons
|
||||
:button-count="3"
|
||||
:text-strings="timeFormatTextStrings"
|
||||
:default-button-index="timeFormatSelectedIndex"
|
||||
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
|
||||
:callback="(index: number) => {settingSave('timeFormat', timeFormatTextStrings[index])}"
|
||||
/>
|
||||
</div>
|
||||
|
@ -20,7 +19,6 @@ import RadioButtons from '~/components/UserInterface/RadioButtons.vue';
|
|||
import type { TimeFormat } from '~/types/settings';
|
||||
|
||||
const timeFormatTextStrings: TimeFormat[] = ["Auto", "4:18 PM", "16:18"]
|
||||
const timeFormatSelectedIndex = timeFormatTextStrings.indexOf(settingsLoad().timeFormat ?? "Auto")
|
||||
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue