Skip to content

Commit

Permalink
create glitchedelement wrapper that respects the reduced motion direc…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
aumetra committed Oct 12, 2023
1 parent 1e8a9ad commit 7da9755
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions kitsune-fe/src/components/GlitchedElement.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<slot v-if="reduceMotion" />

<GlitchedElement v-else :options="options">
<slot />
</GlitchedElement>
</template>

<script lang="ts" setup>
import { usePreferredReducedMotion } from '@vueuse/core';
import { computed } from 'vue';
import { GlitchedElement } from 'vue-powerglitch';
defineProps<{ options?: object }>();
const preferredReducedMotion = usePreferredReducedMotion();
const reduceMotion = computed(() => preferredReducedMotion.value == 'reduce');
</script>
2 changes: 1 addition & 1 deletion kitsune-fe/src/components/NavBarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</template>

<script lang="ts" setup>
import { GlitchedElement } from 'vue-powerglitch';
import GlitchedElement from './GlitchedElement.vue';
defineProps<{
class?: string;
Expand Down
2 changes: 1 addition & 1 deletion kitsune-fe/src/views/NotFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</template>

<script lang="ts" setup>
import { GlitchedElement } from 'vue-powerglitch';
import GlitchedElement from '../components/GlitchedElement.vue';
</script>

<style scoped lang="scss">
Expand Down

0 comments on commit 7da9755

Please sign in to comment.