SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
953 B · 38 lines tsx
Raw Blame History
1"use client";2import * as React from "react";3import { motion, useReducedMotion } from "motion/react";4import { cn } from "@/lib/utils";56/** Tasteful entrance animation on scroll. Renders static markup when the user prefers reduced motion. */7export function Reveal({8  children,9  className,10  delay = 0,11  as = "div",12  y = 14,13}: {14  children: React.ReactNode;15  className?: string;16  delay?: number;17  as?: "div" | "section" | "li" | "span" | "p" | "h1" | "h2";18  y?: number;19}) {20  const reduce = useReducedMotion();21  const Comp = motion[as];22  if (reduce) {23    const Static = as;24    return <Static className={className}>{children}</Static>;25  }26  return (27    <Comp28      className={cn(className)}29      initial={{ opacity: 0, y }}30      whileInView={{ opacity: 1, y: 0 }}31      viewport={{ once: true, margin: "0px 0px -8% 0px" }}32      transition={{ duration: 0.6, delay, ease: [0.16, 1, 0.3, 1] }}33    >34      {children}35    </Comp>36  );37}38