Fix reduce motion sponsor page

This commit is contained in:
Eric
2026-10-31 12:52:35 +01:00
parent 9911daf7d8
commit e116a7dd15
2 changed files with 5 additions and 5 deletions
@@ -7,7 +7,7 @@
</script>
<template>
<TabGroup>
<TabGroup as="div">
<TabList class="tab-list">
<template v-for="(tab, index) in props.tabs" :key="index">
<Tab :id="`tab-${index}`" class="tab">{{ tab }}</Tab>
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { motion, type Options as MotionOptions } from 'motion-v';
import { useMediaQuery } from '@vueuse/core';
// motion-v re-exports framer-motion's `Variants`, which doesn't match the `variants` prop of its components
type Variants = MotionOptions['variants'];
@@ -64,14 +65,13 @@ const onAnimationComplete = (variant: unknown) => {
// Only rendered on the client, so reduced motion is known before the first frame
const mounted = ref(false);
const reducedMotion = ref(false);
const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
onMounted(() => {
reducedMotion.value = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (reducedMotion.value) {
drawAnimation.value = 'exit';
showHandles.value = false;
}
mounted.value = true;
});
@@ -152,7 +152,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
<motion.path
:d="HEART_PATH"
stroke-width="2"
:style="{ stroke: 'var(--vp-c-gray-1)' }"
:style="{ stroke: reducedMotion? 'var(--vp-c-brand)' : 'var(--vp-c-gray-1)' }"
:initial="initial('hidden')"
:animate="drawAnimation"
:variants="draw"