diff --git a/docs/.vitepress/theme/components/base/ButtonMenu.vue b/docs/.vitepress/theme/components/base/ButtonMenu.vue index d130eae70..d86cfb383 100644 --- a/docs/.vitepress/theme/components/base/ButtonMenu.vue +++ b/docs/.vitepress/theme/components/base/ButtonMenu.vue @@ -9,21 +9,29 @@ import { } from '@headlessui/vue' import createLucideIcon from 'lucide-vue-next/src/createLucideIcon' import { chevronUp } from '../../../data/iconNodes' +import { useStorage } from '@vueuse/core' -const props = defineProps<{ +interface Props { options: { text: string onClick?: () => void }[], callOptionOnClick?: boolean buttonClass?: string -}>() + id: string + popoverPosition?: 'top' | 'bottom' +} + +const props = withDefaults(defineProps(), { + callOptionOnClick: false, + popoverPosition: 'bottom' +}) const emit = defineEmits(['click', 'optionClick']) const buttonRef = ref(null) -const selectedOption = ref(props.options[0].text) +const selectedOption = useStorage(props.id, props.options[0].text) const selectionOptionAction = computed(() => props.options.find(option => option.text === selectedOption.value).onClick) function onClick(event) { @@ -51,7 +59,7 @@ const ChevronUp = createLucideIcon('ChevronUp', chevronUp)