Inline Update Strip
Single-row changelog: What's new label, two dated entries (date muted, title white, two-line gray description) and All updates arrow link right.
Rebuilt from silico.ai in the Moonlit Atelier style.
npx shadcn@latest add https://yoink-app.fly.dev/r/moonlit-atelier/blocks/whats-new-ticker.json
Looks exactly like silico.ai: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://yoink-app.fly.dev/r/moonlit-atelier/mine/whats-new-ticker.json
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: label, entries (array of {date, title, description, href}), allHref and allLabel. Renders standalone with defaults; entries fade up on scroll, titles underline on hover and the arrow nudges 2px.
components/whats-new-ticker.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Entry = { date: string; title: string; description: string; href?: string }; type Props = { label?: string; entries?: Entry[]; allHref?: string; allLabel?: string; }; const defaultEntries: Entry[] = [ { date: "Mar 12", title: "Smarter file search", description: "Northwind now locates the right document from a short description, even when the name is only partly remembered.", href: "#" }, { date: "Mar 04", title: "Faster nightly exports", description: "Scheduled exports now finish in half the time and retry on their own whenever a destination is unavailable.", href: "#" }, ]; export default function InlineUpdateStrip({ label = "Latest news", entries = defaultEntries, allHref = "#", allLabel = "All updates", }: Props) { return ( <section className="w-full border-t border-hairline bg-canvas font-sans"> <div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-6 py-6 md:flex-row md:items-start md:px-10"> <p className="w-full shrink-0 text-[14px] leading-[22px] text-secondary md:w-[172px]">{label}</p> <ul className="grid flex-1 gap-6 md:grid-cols-[repeat(2,minmax(0,365px))] md:gap-[0px]"> {entries.map((e, i) => ( <li key={e.title} className="text-[14px] leading-[20px] md:pr-8"> <Reveal from="up" distance={7} duration={620} delay={i * 100}> <p className="flex flex-wrap items-baseline gap-x-2"> <span className="text-muted">{e.date}</span> <a href={e.href} className="text-primary decoration-from-font underline-offset-4 hover:underline focus-visible:underline focus-visible:outline-none" > {e.title} </a> </p> <p className="mt-1 line-clamp-2 text-muted">{e.description}</p> </Reveal> </li> ))} </ul> <a href={allHref} className="group inline-flex items-center gap-1.5 text-[14px] leading-[22px] text-muted transition-colors duration-ui-hover ease-ui-hover hover:text-primary focus-visible:text-primary focus-visible:outline-none md:ml-auto" > {allLabel} <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" className="transition-transform duration-ui-hover ease-ui-hover group-hover:translate-x-[2px] group-focus-visible:translate-x-[2px]" > <path d="M2 6h8M6.5 2.5L10 6l-3.5 3.5" /> </svg> </a> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Entry = { date: string; title: string; description: string; href?: string }; type Props = { label?: string; entries?: Entry[]; allHref?: string; allLabel?: string; }; const defaultEntries: Entry[] = [ { date: "Mar 12", title: "Smarter file search", description: "Northwind now locates the right document from a short description, even when the name is only partly remembered.", href: "#" }, { date: "Mar 04", title: "Faster nightly exports", description: "Scheduled exports now finish in half the time and retry on their own whenever a destination is unavailable.", href: "#" }, ]; export default function InlineUpdateStrip({ label = "Latest news", entries = defaultEntries, allHref = "#", allLabel = "All updates", }: Props) { return ( <section className="w-full border-t border-border bg-background font-sans"> <div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-6 py-6 md:flex-row md:items-start md:px-10"> <p className="w-full shrink-0 text-[14px] leading-[22px] text-muted-foreground md:w-[172px]">{label}</p> <ul className="grid flex-1 gap-6 md:grid-cols-[repeat(2,minmax(0,365px))] md:gap-[0px]"> {entries.map((e, i) => ( <li key={e.title} className="text-[14px] leading-[20px] md:pr-8"> <Reveal from="up" distance={7} duration={620} delay={i * 100}> <p className="flex flex-wrap items-baseline gap-x-2"> <span className="text-muted-foreground">{e.date}</span> <a href={e.href} className="text-foreground decoration-from-font underline-offset-4 hover:underline focus-visible:underline focus-visible:outline-none" > {e.title} </a> </p> <p className="mt-1 line-clamp-2 text-muted-foreground">{e.description}</p> </Reveal> </li> ))} </ul> <a href={allHref} className="group inline-flex items-center gap-1.5 text-[14px] leading-[22px] text-muted-foreground transition-colors duration-moonlit-ui-hover ease-moonlit-ui-hover hover:text-foreground focus-visible:text-foreground focus-visible:outline-none md:ml-auto" > {allLabel} <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" className="transition-transform duration-moonlit-ui-hover ease-moonlit-ui-hover group-hover:translate-x-[2px] group-focus-visible:translate-x-[2px]" > <path d="M2 6h8M6.5 2.5L10 6l-3.5 3.5" /> </svg> </a> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (5 elements)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.