fix(ally): can customize dark mode switch titles now

pull/3311/head
Cesar Gomez 2 years ago
parent 006fd80095
commit b1222f8fea

@ -406,6 +406,20 @@ export interface DocFooter {
Can be used to customize the dark mode switch label. This label is only displayed in the mobile view. Can be used to customize the dark mode switch label. This label is only displayed in the mobile view.
## lightModeSwitchTitle
- Type: `string`
- Default: `Switch to light theme`
Can be used to customize the light mode switch title that appears on hovering.
## darkModeSwitchTitle
- Type: `string`
- Default: `Switch to dark theme`
Can be used to customize the dark mode switch title that appears on hovering.
## sidebarMenuLabel ## sidebarMenuLabel
- Type: `string` - Type: `string`

@ -5,14 +5,18 @@ import VPSwitch from './VPSwitch.vue'
import VPIconMoon from './icons/VPIconMoon.vue' import VPIconMoon from './icons/VPIconMoon.vue'
import VPIconSun from './icons/VPIconSun.vue' import VPIconSun from './icons/VPIconSun.vue'
const { isDark } = useData() const { isDark, theme } = useData()
const toggleAppearance = inject('toggle-appearance', () => { const toggleAppearance = inject('toggle-appearance', () => {
isDark.value = !isDark.value isDark.value = !isDark.value
}) })
const lightModeSwitchTitle = computed(() => theme.value.lightModeSwitchTitle || 'Switch to light theme')
const darkModeSwitchLabel = computed(() => theme.value.darkModeSwitchTitle || 'Switch to dark theme')
const switchTitle = computed(() => { const switchTitle = computed(() => {
return isDark.value ? 'Switch to light theme' : 'Switch to dark theme' return isDark.value ? lightModeSwitchTitle.value : darkModeSwitchLabel.value
}) })
</script> </script>

@ -96,6 +96,16 @@ export namespace DefaultTheme {
*/ */
darkModeSwitchLabel?: string darkModeSwitchLabel?: string
/**
* @default 'Switch to light theme'
*/
lightModeSwitchTitle?: string
/**
* @default 'Switch to dark theme'
*/
darkModeSwitchTitle?: string
/** /**
* @default 'Menu' * @default 'Menu'
*/ */

Loading…
Cancel
Save