feat(buttonNavigation): expose readonly selected button and new select function, to allow user to select any button with path animation

This commit is contained in:
2026-01-14 15:34:02 +01:00
parent 03bbc25f4b
commit 0a8017e34e
4 changed files with 22 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ const ACTIONS = {
[action: "Copy" | "Open", verb: string, content: string]
>;
const { selectedButton, selectorPosition } = useButtonNavigation({
const { selected, selectorPosition } = useButtonNavigation({
buttons: {
github: [26, 27, 202, 42],
email: [26, 59, 202, 42],
@@ -48,7 +48,7 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
disabled: computed(() => store.isIntro || store.isOutro),
});
const actionateButton = async (button: (typeof selectedButton)["value"]) => {
const actionateButton = async (button: (typeof selected)["value"]) => {
const [action, verb, content] = ACTIONS[button];
if (action === "Copy") {
try {
@@ -102,7 +102,7 @@ const actionateButton = async (button: (typeof selectedButton)["value"]) => {
: 1
"
b-label="Quit"
:a-label="ACTIONS[selectedButton][0]"
:a-label="ACTIONS[selected][0]"
@activate-b="store.animateOutro()"
/>
</template>