Projetos sobem sobre o palco do hero e o celular tem hero de uma tela sem mergulho; passagens com animation-timeline em CSS, sem GSAP nem motion; troca da vitrine sem texto duplicado; moldura de celular só com pôster e scrub reencodado em 960 px (9,4 para 5,2 MB); 3D monta na primeira interação e para quando parado; transição entre páginas do mesmo segmento; foco em anel duplo; texto de 15 px no celular; código morto removido.
87 lines
2.2 KiB
TypeScript
87 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import { type CSSProperties, type ReactNode, useRef } from "react";
|
|
import { useInView } from "@/app/hooks/useInView";
|
|
import { DrawLine } from "./animations/DrawLine";
|
|
import { TextDiffuseReveal } from "./animations/TextDiffuseReveal";
|
|
import { Reveal } from "./Reveal";
|
|
|
|
interface SectionProps {
|
|
id?: string;
|
|
eyebrow?: string;
|
|
title: string;
|
|
description?: string;
|
|
dark?: boolean;
|
|
aside?: ReactNode;
|
|
children: ReactNode;
|
|
disableChildrenAnimation?: boolean;
|
|
}
|
|
|
|
/** Atraso (s) de cada item do cabeçalho: entram em escada, como a linha que se desenha logo depois. */
|
|
const stagger = (seconds: number) =>
|
|
({ "--reveal-delay": `${seconds}s` }) as CSSProperties;
|
|
|
|
export const Section = ({
|
|
id,
|
|
eyebrow,
|
|
title,
|
|
description,
|
|
dark,
|
|
aside,
|
|
children,
|
|
disableChildrenAnimation = false,
|
|
}: SectionProps) => {
|
|
const headerRef = useRef<HTMLDivElement>(null);
|
|
const headerShown = useInView(headerRef);
|
|
const baseClass = dark ? "ds-section ds-section-dark" : "ds-section";
|
|
|
|
return (
|
|
<section id={id} className={baseClass}>
|
|
<div className="ds-section-shell">
|
|
<div
|
|
ref={headerRef}
|
|
className="ds-section-header"
|
|
data-shown={headerShown ? "" : undefined}
|
|
>
|
|
<div className="ds-section-meta">
|
|
{eyebrow && (
|
|
<p className="ds-eyebrow ds-reveal" style={stagger(0.02)}>
|
|
{eyebrow}
|
|
</p>
|
|
)}
|
|
|
|
<h2 className="ds-section-title">
|
|
<TextDiffuseReveal text={title} />
|
|
</h2>
|
|
|
|
{description && (
|
|
<p
|
|
className="ds-section-description ds-reveal"
|
|
style={stagger(0.1)}
|
|
>
|
|
{description}
|
|
</p>
|
|
)}
|
|
|
|
<DrawLine delay={0.16} />
|
|
</div>
|
|
|
|
{aside && (
|
|
<aside className="ds-reveal" style={stagger(0.18)}>
|
|
{aside}
|
|
</aside>
|
|
)}
|
|
</div>
|
|
|
|
{!disableChildrenAnimation ? (
|
|
<Reveal y={40} duration={0.9} delay={0.12}>
|
|
<div>{children}</div>
|
|
</Reveal>
|
|
) : (
|
|
<div>{children}</div>
|
|
)}
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|