"use client"; import { useState } from "react"; import { useSpring, animated } from "@react-spring/web"; import useMeasure from "react-use-measure"; // The read-only "ALT" pill that expands to reveal alt text. Shared by the // editor (ImageAltButton's reader mode) and published posts so both render alt // text identically. Purely presentational — takes the alt string directly so it // has no replicache dependency and is safe to render on public post pages. export function ReadOnlyAltText(props: { alt: string; className?: string }) { let [showAlt, setShowAlt] = useState(false); let [altRef, { height: altHeight }] = useMeasure(); let altStyle = useSpring({ height: showAlt ? altHeight : 0, opacity: showAlt ? 1 : 0, config: { tension: 450, friction: 30 }, }); if (!props.alt) return null; return (