From 6af24bf878420ed30cf6e39b67c46ad8a19e8992 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Tue, 9 May 2023 10:10:42 +0200 Subject: [PATCH] Fixes Button menu --- .../theme/components/base/ButtonMenu.vue | 46 +++++- .../theme/components/icons/CopyCodeButton.vue | 110 +------------- .../theme/components/icons/CopySVGButton.vue | 141 ++++-------------- .../components/icons/IconDetailOverlay.vue | 2 +- .../theme/components/icons/IconInfo.vue | 5 +- .../theme/components/icons/confetti.css | 102 +++++++++++++ 6 files changed, 179 insertions(+), 227 deletions(-) create mode 100644 docs/.vitepress/theme/components/icons/confetti.css 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)