docs/.vitepress/theme/components/settings/Takodachi.vue

9bd349bd40e468a84023ee1281506de1333015e7
wotaku/docs/.vitepress/theme/components/settings/Takodachi.vue
taskylizard wotaku 2bea9706e6c 1 year ago

56 lines · 1828 bytes

 1<script setup lang="ts">
 2import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui'
 3import { useStorage } from '@vueuse/core'
 4import { computed, ref } from 'vue'
 5
 6import MenuHelp from './MenuHelp.vue'
 7import MenuTitle from './MenuTitle.vue'
 8
 9import { TakodachiStorageKey } from '../../constants'
10
11const menuTitleElementRef = ref<HTMLDivElement>()
12const isMenuHelpPoppedUp = ref(false)
13const disabled = ref(false)
14
15const takodachToggledOn = useStorage(TakodachiStorageKey, false)
16
17const fieldOptions = computed(() => [
18  {
19    value: true,
20    title: 'On',
21    ariaLabel: 'On',
22    text: 'ON',
23    name: 'Takodachi Toggle Switch'
24  },
25  {
26    value: false,
27    title: 'Off',
28    ariaLabel: 'Off',
29    text: 'OFF',
30    name: 'Takodachi Toggle Switch'
31  }
32])
33</script>
34
35<template>
36  <div space-y-2 role="radiogroup">
37    <div ref="menuTitleElementRef" relative flex items-center>
38      <MenuTitle title="Takodachi" aria-label="Takodachi" :disabled="disabled" flex="1" pr-4>
39        <template #icon>
40          <img src="/takodachi.webp" alt="Takodachi" class="w-6 h-6 mr-1" aria-hidden="true" />
41        </template>
42      </MenuTitle>
43      <MenuHelp v-model:is-popped-up="isMenuHelpPoppedUp" :menu-title-element-ref="menuTitleElementRef">
44        <h4 text-md mb-1 font-semibold>Takodachi</h4>
45        <p text="sm" mb-2 max-w-100>
46          <span>Gives you a cool takodachi following your cursor.</span>
47        </p>
48      </MenuHelp>
49    </div>
50    <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
51      <NuInputHorizontalRadioGroup v-model="takodachToggledOn"
52        bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
53        text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" :options="fieldOptions" :disabled="disabled" />
54    </NuInputHighlight>
55  </div>
56</template>
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form