feat(common): implement buttons and confirmation modal
This commit is contained in:
@@ -20,12 +20,16 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
||||
}
|
||||
>;
|
||||
}) => {
|
||||
const { state: modalState } = useConfirmationModal();
|
||||
|
||||
const selectedButton = ref(initialButton);
|
||||
const selectorPosition = computed(() => buttons[selectedButton.value]!);
|
||||
|
||||
const nextButton = ref<keyof T | undefined>();
|
||||
|
||||
useScreenClick((x: number, y: number) => {
|
||||
if (modalState.value.isOpen) return;
|
||||
|
||||
for (const [buttonName, config] of Object.entries(buttons) as [
|
||||
keyof T,
|
||||
ButtonConfig,
|
||||
@@ -52,6 +56,8 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
||||
});
|
||||
|
||||
useKeyDown((key) => {
|
||||
if (modalState.value.isOpen) return;
|
||||
|
||||
const currentButton = selectedButton.value as keyof T;
|
||||
const currentNav = navigation[currentButton];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user