fix: stabilize reveals and update contact email

This commit is contained in:
Evandro Fonseca Junior committed 2026-08-08 19:42:40 -03:00
1 parent aad56ad885
commit cdde81eb6e
22 files changed
+144 -40

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
"use client";
import { useInView } from "framer-motion";
import { useEffect, useRef, useState } from "react";
import { useInView, useReducedMotion } from "framer-motion";
import { useReducedMotion } from "@/app/hooks/useReducedMotion";
interface CounterValueProps {
value: number;
+2 -1
View File
@@ -1,7 +1,8 @@
"use client";
import { motion } from "framer-motion";
import { useState } from "react";
import { motion, useReducedMotion } from "framer-motion";
import { useReducedMotion } from "@/app/hooks/useReducedMotion";
interface DrawLineProps {
className?: string;
@@ -1,8 +1,9 @@
"use client";
import { useState } from "react";
import { motion } from "framer-motion";
import Image, { type StaticImageData } from "next/image";
import { motion, useReducedMotion } from "framer-motion";
import { useState } from "react";
import { useReducedMotion } from "@/app/hooks/useReducedMotion";
interface LazyRevealImageProps {
src: string | StaticImageData;
@@ -0,0 +1,81 @@
import { render } from "@testing-library/react";
import type { ReactNode } from "react";
import { TextDiffuseReveal } from "./TextDiffuseReveal";
let mockReducedMotion = false;
let mockInView = true;
let mockAnimations: Array<{ animate?: Record<string, unknown> }> = [];
jest.mock("framer-motion", () => {
const React = require("react");
return {
motion: {
span: ({
children,
initial: _initial,
animate,
transition: _transition,
onAnimationComplete: _onAnimationComplete,
...props
}: {
children?: ReactNode;
initial?: unknown;
animate?: Record<string, unknown>;
transition?: unknown;
onAnimationComplete?: () => void;
} & Record<string, unknown>) => {
mockAnimations.push({ animate });
return React.createElement("span", props, children);
},
},
useInView: () => mockInView,
useReducedMotion: () => mockReducedMotion,
};
});
describe("TextDiffuseReveal reduced motion", () => {
beforeEach(() => {
mockReducedMotion = false;
mockInView = true;
mockAnimations = [];
});
it("clears blur and scale when reduced motion resolves after mount", () => {
const { rerender } = render(<TextDiffuseReveal text="Reveal" />);
mockAnimations = [];
mockReducedMotion = true;
rerender(<TextDiffuseReveal text="Reveal" />);
expect(mockAnimations).toHaveLength(6);
expect(mockAnimations).toEqual(
expect.arrayContaining(
Array.from({ length: 6 }, () =>
expect.objectContaining({
animate: {
opacity: 1,
filter: "blur(0px)",
scale: 1,
},
}),
),
),
);
});
it("keeps the first render independent of the reduced-motion preference", () => {
mockReducedMotion = true;
mockInView = false;
render(<TextDiffuseReveal text="Reveal" />);
expect(mockAnimations[0]).toEqual({
animate: {
filter: "blur(12px)",
opacity: 0,
scale: 0.9,
},
});
});
});
@@ -1,7 +1,8 @@
"use client";
import { motion, useInView, useReducedMotion } from "framer-motion";
import { motion, useInView } from "framer-motion";
import { useEffect, useMemo, useRef, useState } from "react";
import { useReducedMotion } from "@/app/hooks/useReducedMotion";
interface TextDiffuseRevealProps {
text: string;
@@ -101,11 +102,9 @@ export function TextDiffuseReveal({
}
animate={
isInView
? shouldReduceMotion
? { opacity: 1 }
: { filter: "blur(0px)", opacity: 1, scale: 1 }
? { filter: "blur(0px)", opacity: 1, scale: 1 }
: shouldReduceMotion
? { opacity: 0 }
? { filter: "blur(0px)", opacity: 0, scale: 1 }
: { filter: "blur(12px)", opacity: 0, scale: 0.9 }
}
transition={{
+2 -1
View File
@@ -1,6 +1,7 @@
"use client";
import { motion, useReducedMotion } from "framer-motion";
import { motion } from "framer-motion";
import { useReducedMotion } from "@/app/hooks/useReducedMotion";
interface TopProgressBarProps {
className?: string;