Skip to content

Commit d5424f7

Browse files
committed
perf: disable animations when prefers-reduced-motion is enabled
1 parent d373f3c commit d5424f7

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/Web/Homepage/home.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
?>
99

10-
<x-base full-title="Tempest, the PHP framework that gets out of your way" :stargazers="$stargazers" body-class="bg-[#f1f7ff]">
10+
<x-base full-title="Tempest, the PHP framework that gets out of your way" :stargazers="$stargazers" body-class="bg-[#f1f7ff] dark:bg-[black]">
1111
<div class="flex flex-col grow font-display">
1212
<!-- Falling leaves -->
1313
<x-falling-leaves class="dark:hidden" />

src/Web/Homepage/x-aurora.view.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<x-component name="x-aurora">
22
<div class="absolute inset-0 overflow-hidden pointer-events-none z-[-1]" :class="$class">
3-
<div class="
3+
<div class="
44
[--color-white-gradient:repeating-linear-gradient(100deg,white_0%,white_7%,transparent_10%,transparent_12%,white_16%)]
55
[--color-aurora-gradient:repeating-linear-gradient(100deg,var(--color-aurora-1)_10%,var(--color-aurora-2)_15%,var(--color-aurora-3)_20%,var(--color-aurora-4)_25%,var(--color-aurora-5)_30%)]
66
[background-image:var(--color-white-gradient),var(--color-aurora-gradient)]
77
[background-size:300%,_200%]
88
[background-position:50%_50%,50%_50%]
99
filter
10-
blur-[10px]
10+
motion-safe:blur-[10px]
1111
invert
1212
after:content-['']
1313
after:absolute
1414
after:inset-0
1515
after:[background-image:var(--color-white-gradient),var(--color-aurora-gradient)]
1616
after:[background-size:200%,_100%]
17-
after:animate-aurora
17+
motion-safe:after:animate-aurora
1818
after:[background-attachment:fixed]
1919
after:mix-blend-difference
2020
pointer-events-none

src/Web/Homepage/x-falling-leaves.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<x-component name="x-falling-leaves">
22
<!-- Leaves container -->
3-
<div class="absolute inset-0 overflow-hidden pointer-events-none" id="leaves-container"></div>
3+
<div class="absolute inset-0 overflow-hidden pointer-events-none motion-reduce:hidden" id="leaves-container"></div>
44
<!-- Leaves templates -->
55
<template id="leaf-template-1">
66
<div class="leaf absolute pointer-events-none origin-center">

src/Web/Homepage/x-moonlight.view.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<x-component name="x-moonlight">
22
<!-- Moonlight container -->
33
<div class="
4-
hidden dark:block
4+
hidden
5+
dark:block
56
[--color-white-gradient:repeating-linear-gradient(100deg,rgba(255,255,255,.8)_0%,rgba(255,255,255,.4)_1%,transparent_10%,transparent_12%,rgba(255,255,255,.4)_16%)]
67
[background-image:var(--color-white-gradient)]
78
[background-size:300%,_200%]
@@ -14,7 +15,7 @@
1415
after:inset-0
1516
after:[background-image:var(--color-white-gradient)]
1617
after:[background-size:200%,_100%]
17-
after:animate-aurora
18+
motion-safe:after:animate-aurora
1819
after:[background-attachment:fixed]
1920
after:mix-blend-difference
2021
pointer-events-none

src/Web/Homepage/x-rain.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<!-- Script, See https://github.com/tempestphp/tempest-framework/pull/996 -->
33
{{ \Tempest\vite_tags('src/Web/Homepage/rain.ts') }}
44
<!-- Rain container -->
5-
<div class="absolute inset-0 overflow-hidden pointer-events-none dark:opacity-100 opacity-0 duration-500 z-[-1]" id="rain-container"></div>
5+
<div class="motion-reduce:hidden absolute inset-0 overflow-hidden pointer-events-none dark:opacity-100 opacity-0 duration-500 z-[-1]" id="rain-container"></div>
66
</x-component>

0 commit comments

Comments
 (0)