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 6e807ca
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kitsune-fe/src/components/CaptchaComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/>

<vue-hcaptcha
v-if="backend == CaptchaBackend.HCaptcha"
v-if="backend === CaptchaBackend.HCaptcha"
:sitekey="sitekey"
@verify="onVerify"
@expired="onExpire"
Expand Down Expand Up @@ -58,7 +58,7 @@
}
onMounted(async () => {
if (props.backend == CaptchaBackend.MCaptcha) {
if (props.backend === CaptchaBackend.MCaptcha) {
const config = {
widgetLink: new URL(props.sitekey),
};
Expand Down
21 changes: 21 additions & 0 deletions kitsune-fe/src/components/GlitchedElement.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<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 6e807ca

Please sign in to comment.