Page sections / Feature sections

Accordion Feature Showcase

Left list of titles separated by hairlines; the active item expands with description and sub-bullets while others stay dim. Right shows dark rounded demo cards: a chat bubble with model-choice status and a dense grid of tiny squares representing available models. Backed by a dim harbor painting.

Rebuilt from silico.ai in the Moonlit Atelier style.

npx shadcn@latest add https://justyoink.it/r/moonlit-atelier/blocks/accordion-feature-showcase.json

Looks exactly like silico.ai: brings its fonts and colours, namespaced so your own theme stays untouched.

ImagesSwap it for a library image or one of your own.All images in this style →

Choose an image

Image

Loading…

Usage

Props: heading, prompt, items (title/body/bullets), imageSrc, total. Items auto-advance every 30s and can be clicked; the grid of squares fills in on load.

components/accordion-feature-showcase.tsx
"use client";

import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
import { useEffect, useState } from "react";

type Item = { title: string; body: string; bullets: string[] };

const DEFAULT_ITEMS: Item[] = [
  { title: "The right tool for each task", body: "No single engine excels at every job. Harbor Desk routes planning, numbers, drafting and visuals to the engines that handle each one best.", bullets: ["Browse over 200 engines", "Choose a favorite, or leave it on Auto", "Fresh engines appear as they ship"] },
  { title: "Many hands, one thread", body: "Work is split into parallel lanes that report back together.", bullets: ["Parallel lanes", "Shared notes", "One summary"] },
  { title: "A workspace of its own", body: "Every run gets a private sandbox to try things safely.", bullets: ["Isolated files", "Safe previews", "Easy rollback"] },
  { title: "Results that are reviewed", body: "Each draft is double checked before it reaches you.", bullets: ["Automatic review", "Source links", "Change notes"] },
  { title: "Expertise baked in", body: "Playbooks from seasoned practitioners guide every step.", bullets: ["Templates", "Checklists", "Style guides"] },
  { title: "Context that persists", body: "Preferences and past decisions are remembered between sessions.", bullets: ["Saved preferences", "Project history", "Shared glossary"] },
];

export default function AccordionFeatureShowcase({
  heading = "Better results, start to finish.",
  prompt = "Map out our tea club opening in Portugal",
  items = DEFAULT_ITEMS,
  imageSrc = "https://yoink-app.fly.dev/stock/abstract-6.jpg",
  total = 200,
}: {
  heading?: string;
  prompt?: string;
  items?: Item[];
  imageSrc?: string;
  total?: number;
}) {
  const [active, setActive] = useState(0);
  const [filled, setFilled] = useState(0);
  useEffect(() => {
    const t = setTimeout(() => setActive((a) => (a + 1) % items.length), 30000);
    return () => clearTimeout(t);
  }, [active, items.length]);
  useEffect(() => {
    const i = setInterval(() => setFilled((f) => (f >= total ? total : f + 4)), 40);
    return () => clearInterval(i);
  }, [total]);

  return (
    <section className="relative isolate overflow-hidden bg-canvas px-6 py-24 text-primary md:px-10">
      <img src={imageSrc} alt="" width={1600} height={1067} className="absolute inset-0 -z-20 h-full w-full object-cover opacity-30 saturate-[0.85]" />
      <div className="absolute inset-0 -z-10 bg-[linear-gradient(var(--color-canvas)_0%,transparent_26%,transparent_74%,var(--color-canvas)_100%)]" />
      <Reveal from="up">
        <h2 className="max-w-[760px] font-serif text-h1 md:text-display">{heading}</h2>
      </Reveal>
      <div className="mt-16 grid gap-10 lg:grid-cols-2">
        <ul className="max-w-[536px] border-t border-hairline">
          {items.map((it, i) => (
            <li key={it.title} className="border-b border-hairline last:border-b-0">
              <button type="button" onClick={() => setActive(i)} aria-expanded={active === i} className="relative w-full py-5 text-left focus-visible:outline focus-visible:outline-1">
                <span className={`block transition-colors duration-ui-hover ease-ui-hover ${active === i ? "text-lead text-primary" : "text-lead text-muted hover:text-primary"}`}>{it.title}</span>
                {active === i && (
                  <>
                    <span className="mt-2 block text-body text-secondary">{it.body}</span>
                    <span className="mt-4 block space-y-1 text-caption text-muted">
                      {it.bullets.map((b) => (<span key={b} className="block">{b}</span>))}
                    </span>
                    <span key={active} className="absolute inset-x-0 top-0 h-px origin-left bg-primary/60 motion-safe:animate-[grow_30s_linear_forwards]" style={{ animation: "yk-grow 29.6s linear forwards" }} />
                  </>
                )}
              </button>
            </li>
          ))}
        </ul>
        <div className="space-y-4">
          <div className="min-h-[360px] rounded-xl border border-hairline bg-surface p-4 shadow-float-window">
            <div className="ml-auto w-fit rounded-xl bg-surface-high px-4 py-3 text-body">{prompt}</div>
            <div className="mt-3 flex justify-end">
              <span className="rounded-pill border border-hairline px-3 py-1.5 text-caption text-secondary">Auto (best quality) ⌄</span>
            </div>
            <p className="mt-4 flex items-center gap-3 text-caption text-secondary"><span className="h-2 w-2 rounded-full bg-secondary" />Picking an engine for each part</p>
          </div>
          <div className="rounded-xl border border-hairline bg-canvas-warm p-4">
            <div className="flex justify-between text-caption text-muted"><span>How Harbor Desk chooses</span><span className="font-mono">{total} engines</span></div>
            <div className="mt-1 flex justify-between text-body"><span>Research the Lisbon market</span><span className="font-mono text-caption text-secondary">{total} engines</span></div>
            <div className="mt-4 grid grid-cols-[repeat(auto-fill,8px)] gap-[4px]">
              {Array.from({ length: total }).map((_, i) => (
                <span key={i} className={`h-2 w-2 rounded-[2px] transition-colors duration-300 ${i < filled ? "bg-muted" : "bg-surface-raised"}`} />
              ))}
            </div>
            <p className="mt-3 text-caption text-muted">{total} engines available</p>
          </div>
        </div>
      </div>
      <style>{`@keyframes yk-grow{from{transform:scaleX(0)}to{transform:scaleX(1)}}`}</style>
    </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
—

More from Moonlit Atelier

The whole style →

Inline Update Strip

Changelog

Hairline Capability Grid

Lists

Painted Landscape Hero

Heroes

Transparent Minimal Nav Bar

Headers & nav bars

Dark Prompt Composer

Prompt & chat inputs

Perspective Floating App Window

Media & mockups