This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/components/input/fancycheckbox.story.vue

85 lines
1.7 KiB
Vue
Raw Normal View History

2023-03-07 16:59:12 +00:00
<script lang="ts" setup>
import {ref} from 'vue'
import {logEvent} from 'histoire/client'
import FancyCheckbox from './fancycheckbox.vue'
const isDisabled = ref<boolean | undefined>()
const isChecked = ref(false)
const isCheckedInitiallyEnabled = ref(true)
const isCheckedDisabled = ref(false)
const withoutInitialState = ref<boolean | undefined>()
</script>
<template>
<Story :layout="{ type: 'grid', width: '200px' }">
<Variant title="Default">
<FancyCheckbox
v-model="isChecked"
:disabled="isDisabled"
>
This is probably not important
</FancyCheckbox>
Visualisation
2024-02-07 11:18:19 +00:00
<input
v-model="isChecked"
type="checkbox"
>
2023-03-07 16:59:12 +00:00
{{ isChecked }}
</Variant>
<Variant title="Enabled Initially">
<FancyCheckbox
v-model="isCheckedInitiallyEnabled"
2024-02-07 11:18:19 +00:00
:disabled="isDisabled"
2023-03-07 16:59:12 +00:00
>
We want you to use this option
</FancyCheckbox>
Visualisation
2024-02-07 11:18:19 +00:00
<input
v-model="isCheckedInitiallyEnabled"
type="checkbox"
>
2023-03-07 16:59:12 +00:00
{{ isCheckedInitiallyEnabled }}
</Variant>
<Variant title="Disabled">
<FancyCheckbox
disabled
2024-02-07 11:18:19 +00:00
:model-value="isCheckedDisabled"
@update:modelValue="logEvent('Setting disabled: This should never happen', $event)"
2023-03-07 16:59:12 +00:00
>
You can't change this
</FancyCheckbox>
Visualisation
2024-02-07 11:18:19 +00:00
<input
v-model="isCheckedDisabled"
type="checkbox"
disabled
>
2023-03-07 16:59:12 +00:00
{{ isCheckedDisabled }}
</Variant>
<Variant title="Undefined initial State">
<FancyCheckbox
v-model="withoutInitialState"
:disabled="isDisabled"
>
Not sure what the value should be
</FancyCheckbox>
Visualisation
2024-02-07 11:18:19 +00:00
<input
v-model="withoutInitialState"
type="checkbox"
disabled
>
2023-03-07 16:59:12 +00:00
{{ withoutInitialState }}
</Variant>
</Story>
</template>