Taster

진단부품톤 고르기
부품 갤러리 / Workflow section

Workflow section

Feature and content section

Number steps only when order matters. A workflow is shown as tabs or a vertical accordion, the body in neutral tones, with one always-visible assistant dock below.

내 사이트에서 가져오기

색을 고르면 아래 부품이 그 색으로 바뀝니다.

실제로 돌아가는 부품입니다. 눌러 보고 입력해 보세요.

내 앱에 넣기

  1. 아직 npm 패키지가 없어서 Taster 리포를 받아 그 안의 명령을 씁니다. 내 앱 폴더가 들어 있는 폴더에서 한 번만 받습니다.

    git clone https://github.com/makim-414/taster.git && npm ci --prefix taster/packages/engine
  2. 내 앱 폴더에서 이 부품을 넣습니다. 부품 파일과 토큰 파일이 src/components/taster 에 들어갑니다.

    node ../taster/packages/engine/cli.mjs add marketing/workflow-section --from https://taster-six.vercel.app --dir src/components/taster
  3. 부품은 Tailwind 클래스로 그리고, Taster 프리셋이 그 클래스를 토큰에 연결합니다. Tailwind CSS 를 설치하고, tokens.css 를 앱 루트에서 한 번 불러온 뒤, 앱 루트에 이 설정을 둡니다. 프리셋이 없으면 빌드는 되어도 부품이 스타일 없이 나옵니다.

    // tailwind.config.cjs
    module.exports = {
      presets: [require('./src/components/taster/tailwind-preset.cjs')],
      content: ['./index.html', './src/**/*.{ts,tsx}'],
    };

    Tailwind v3 는 이 파일을 그대로 읽습니다. v4 는 Tailwind 를 불러오는 src/ 의 스타일시트 맨 위에 이 두 줄을 넣습니다.

    @import "tailwindcss";
    @config "../tailwind.config.cjs";

    tokens.css 는 :root 에 --bg, --text, --border, --accent 를 정의합니다. 내 앱의 스타일시트가 같은 이름을 뒤에서 다시 정의하면 그쪽 색이 이깁니다. 새 Vite 앱의 스타터 CSS 처럼 그런 변수가 있으면 지우거나 이름을 바꾸세요.

언제 쓰나요

  • Step workflow sectionNumber steps only when order matters. A workflow is shown as tabs or a vertical accordion, the body in neutral tones, with one always-visible assistant dock below.

대신 없애 주는 AI 티

  • Tinted pill badge (AC-04)
  • Large colored glow shadow (COL-07)
  • 01 / 02 / 03 section numbers (LAY-03)

정보

설치할 패키지
tailwindcss
라이선스
MIT
코드 보기
"use client";

/**
 * WorkflowSection. A landing section with step tabs and an always-on agent dock.
 * Neutral palette only: a full-bleed backdrop with a notched corner, a dot texture,
 * a per-tab radial glow, a floating tab rail at the lower left, and an opaque step card
 * paired with the agent dock. Steps are numbered 1, 2, 3 because they are a real sequence. Plain React, no animation library, inline SVG icons.
 * Every color is a theme token, so the section is dark on the dark core and paper on the light theme. Lines, fills and
 * glows are the text color at a low strength, which is white on dark and ink on light. Under reduced motion the
 * particle orb draws one still frame and the step card fades in without moving.
 */

import * as React from "react";
import { Icon, type IconName } from "../icons";
import { useReducedMotion } from "../motion/_motion";

/** The text color at `pct` percent over whatever is behind it. */
const ink = (pct: number) => `color-mix(in oklab, var(--text) ${pct}%, transparent)`;
/** An opaque surface `pct` percent of the way from the page to the text color, for the card, the dock and the rail. */
const raised = (pct: number) => `color-mix(in oklab, var(--text) ${pct}%, var(--bg))`;

type TabIcon = (p: { className?: string; style?: React.CSSProperties }) => React.ReactElement;
const makeIcon = (name: IconName): TabIcon => (props) => (
  <Icon name={name} strokeWidth={2.25} className={props.className} style={{ width: "100%", height: "100%", ...props.style }} />
);
const IconSearch = makeIcon("search");
const IconChartLine = makeIcon("chart-line");
const IconList = makeIcon("list");
const IconCheck = makeIcon("check");
const IconChartBar = makeIcon("chart-bar");
const IconArrowUR = makeIcon("arrow-up-right");

export type WorkflowTab = {
  key: string; label: string; heading: string; badge: string; goal: string;
  icon: TabIcon;
  body: React.ReactNode;
  /** Backdrop radial gradient for this tab (neutral). */ glow: string;
};
export interface WorkflowSectionProps {
  eyebrow?: string; heading?: string; body?: string;
  tabs?: WorkflowTab[];
  agent?: { title: string; online: string; msgs: { role: "agent" | "user"; text: string }[]; input: string };
}

/* Neutral particle orb. The dots take the canvas's own color (var(--text)) and repaint when the theme changes.
   Reduced motion paints one still frame and never asks for an animation frame. */
function ParticleOrb({ size = 120 }: { size?: number }) {
  const ref = React.useRef<HTMLCanvasElement>(null);
  const reduced = useReducedMotion();
  React.useEffect(() => {
    const c = ref.current; if (!c) return; const ctx0 = c.getContext("2d"); if (!ctx0) return; const ctx: CanvasRenderingContext2D = ctx0;
    const dpr = Math.min(window.devicePixelRatio || 1, 1.75); c.width = size * dpr; c.height = size * dpr;
    const N = 84, cx = size / 2, cy = size / 2, R = size * 0.36;
    const pts = Array.from({ length: N }, (_, i) => ({ phi: Math.acos(1 - (2 * (i + 0.5)) / N), th: Math.PI * (1 + Math.sqrt(5)) * i, r: 0.85 + Math.random() * 0.3 }));
    let raf = 0, t = 0, dot = getComputedStyle(c).color;
    function paint() {
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0); ctx.clearRect(0, 0, size, size); ctx.fillStyle = dot;
      for (const p of pts) {
        const a = p.th + t, x = cx + R * p.r * Math.sin(p.phi) * Math.cos(a), y = cy + R * p.r * Math.cos(p.phi), z = Math.sin(p.phi) * Math.sin(a);
        ctx.globalAlpha = 0.25 + 0.5 * (z + 1) / 2; ctx.beginPath(); ctx.arc(x, y, 1 + (z + 1) * 0.6, 0, 7); ctx.fill();
      }
      ctx.globalAlpha = 1;
    }
    function draw() {
      raf = 0; if (document.hidden) return;
      t += 0.004; paint(); raf = requestAnimationFrame(draw);
    }
    const run = () => { if (!reduced && !raf && !document.hidden) raf = requestAnimationFrame(draw); };
    const themes = new MutationObserver(() => { dot = getComputedStyle(c).color; paint(); });
    themes.observe(document.documentElement, { attributes: true, attributeFilter: ["class", "style", "data-theme"] });
    document.addEventListener("visibilitychange", run);
    paint(); run();
    return () => { cancelAnimationFrame(raf); themes.disconnect(); document.removeEventListener("visibilitychange", run); };
  }, [size, reduced]);
  return <canvas ref={ref} style={{ width: size, height: size, display: "block", color: "var(--text)" }} aria-hidden />;
}

/* Tab bodies (neutral) */
const wrapBody: React.CSSProperties = { width: "100%" };
const Chip = ({ n }: { n: string }) => <span style={{ fontSize: 10, fontWeight: 700, color: "var(--bg)", background: "var(--text)", borderRadius: 6, padding: "2px 6px" }}>{n}</span>;
const ListBody = () => (
  <div style={{ ...wrapBody, display: "flex", flexDirection: "column", gap: 7 }}>
    {[["Candidate A", "@handle"], ["Candidate B", "@handle"], ["Candidate C", "@handle"]].map(([a, b], i) => (
      <div key={i} style={{ display: "flex", alignItems: "center", gap: 8, padding: "8px 10px", borderRadius: 9, border: "1px solid var(--border)", background: ink(3) }}>
        <Chip n={String.fromCharCode(65 + i)} /><span style={{ fontSize: 12, fontWeight: 600, color: "var(--text)" }}>{a}</span>
        <span style={{ marginLeft: "auto", fontSize: 11, color: "var(--text-muted)" }}>{b}</span>
      </div>
    ))}
  </div>
);
const BarsBody = () => (
  <div style={{ ...wrapBody, display: "flex", flexDirection: "column", gap: 9 }}>
    {[["Channel A", 82], ["Channel B", 64], ["Channel C", 41]].map(([l, v]) => (
      <div key={l as string} style={{ display: "flex", alignItems: "center", gap: 10 }}>
        <span style={{ width: 54, fontSize: 10.5, color: "var(--text-muted)" }}>{l}</span>
        <div style={{ flex: 1, height: 13, borderRadius: 3, background: ink(4), overflow: "hidden" }}>
          <div style={{ height: "100%", width: `${v}%`, background: ink(35 + (v as number) / 4), borderRadius: 3 }} />
        </div>
        <span style={{ width: 26, textAlign: "right", fontSize: 11, fontWeight: 700, color: "var(--text)", fontVariantNumeric: "tabular-nums" }}>{v}</span>
      </div>
    ))}
  </div>
);
const OrbBody = () => <div style={{ ...wrapBody, display: "flex", justifyContent: "center", padding: "4px 0" }}><ParticleOrb size={128} /></div>;
const CheckBody = () => (
  <div style={{ ...wrapBody, display: "flex", flexDirection: "column", gap: 9 }}>
    {["Tone consistent", "Length in spec", "CTA included"].map((l, i) => (
      <div key={l} style={{ display: "flex", alignItems: "center", gap: 9, fontSize: 12, color: "var(--text)" }}>
        <span style={{ color: i < 2 ? "var(--text)" : "var(--text-subtle)", width: 15, height: 15, display: "inline-flex" }}>
          {i < 2 ? <IconCheck /> : <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2.25}><circle cx="12" cy="12" r="8" /></svg>}
        </span>{l}
      </div>
    ))}
  </div>
);
const KpiBody = () => (
  <div style={{ ...wrapBody, display: "grid", gridTemplateColumns: "1fr 1fr", gap: 9 }}>
    {[["Reach", "128K"], ["Conversion", "3.2%"], ["Saves", "9.1K"], ["Shares", "1.4K"]].map(([k, v]) => (
      <div key={k} style={{ border: "1px solid var(--border)", borderRadius: 11, padding: "10px 12px" }}>
        <div style={{ fontSize: 10.5, color: "var(--text-muted)" }}>{k}</div>
        <div style={{ fontSize: 20, fontWeight: 600, color: "var(--text)", marginTop: 3, fontVariantNumeric: "tabular-nums" }}>{v}</div>
      </div>
    ))}
  </div>
);

/** One low-contrast radial per tab: the text color at `peak` percent in the middle, a sixth of that at `mid`, the page at the edge. */
const glow = (shape: string, peak: number, mid: number) =>
  `radial-gradient(${shape}, ${ink(peak)} 0%, ${ink(peak / 6)} ${mid}%, var(--bg) 100%)`;
const DEFAULT_TABS: WorkflowTab[] = [
  { key: "discover", label: "Discovery", heading: "Find candidates", badge: "Scanning", goal: "Collect candidates that match your criteria.", icon: IconSearch, body: <ListBody />, glow: glow("75% 80% at 18% 60%", 7, 45) },
  { key: "analysis", label: "Analysis", heading: "Analyze", badge: "Analyzing", goal: "Break down the signals behind what works.", icon: IconChartLine, body: <OrbBody />, glow: glow("70% 80% at 55% 45%", 8, 50) },
  { key: "briefs", label: "Briefs", heading: "Generate briefs", badge: "AI generated", goal: "Draft tone, length and CTA to spec.", icon: IconList, body: <CheckBody />, glow: glow("60% 85% at 50% 40%", 7, 50) },
  { key: "qc", label: "QC", heading: "Review automatically", badge: "Auto-checked", goal: "Check every draft against the brief.", icon: IconCheck, body: <BarsBody />, glow: glow("70% 80% at 62% 58%", 7, 50) },
  { key: "publish", label: "Publish", heading: "Publish and track", badge: "Tracking", goal: "See reach and conversion broken down.", icon: IconChartBar, body: <KpiBody />, glow: glow("65% 80% at 42% 55%", 7, 50) },
];
const DEFAULT_AGENT = {
  title: "Talk to the agent any time", online: "Online",
  msgs: [
    { role: "agent" as const, text: "Found 12 new candidates that match." },
    { role: "user" as const, text: "Draft the top 3." },
    { role: "agent" as const, text: "Done. 3 drafts are ready to send." },
  ],
  input: "Ask the agent...",
};

function AgentDock({ agent }: { agent: NonNullable<WorkflowSectionProps["agent"]> }) {
  return (
    <div style={{ width: 280, flexShrink: 0, display: "flex", flexDirection: "column", borderRadius: 26, border: "1px solid var(--border)", background: raised(2), padding: 20 }}>
      <p style={{ fontSize: 14, fontWeight: 600, lineHeight: 1.3, letterSpacing: "-.01em", color: "var(--text)", margin: 0 }}>{agent.title}</p>
      <span style={{ marginTop: 4, display: "inline-flex", alignItems: "center", gap: 5, fontSize: 10, color: "var(--text-muted)" }}>
        <span style={{ width: 6, height: 6, borderRadius: 999, background: "var(--text-muted)" }} />{agent.online}
      </span>
      <div style={{ display: "flex", justifyContent: "center", padding: "6px 0" }}><ParticleOrb size={116} /></div>
      <div style={{ marginTop: 10, display: "flex", flexDirection: "column", gap: 7 }}>
        {agent.msgs.map((m, i) => {
          const u = m.role === "user";
          return (
            <div key={i} style={{ display: "flex", justifyContent: u ? "flex-end" : "flex-start" }}>
              <p style={{ maxWidth: "86%", fontSize: 11.5, lineHeight: 1.4, padding: "6px 11px", margin: 0, borderRadius: u ? "15px 15px 4px 15px" : "15px 15px 15px 4px", background: u ? "var(--text)" : ink(6), color: u ? "var(--bg)" : "var(--text)" }}>{m.text}</p>
            </div>
          );
        })}
      </div>
      <div style={{ marginTop: 14, display: "flex", alignItems: "center", gap: 8, borderRadius: 999, border: "1px solid var(--border)", background: ink(3), padding: "8px 12px" }}>
        <span style={{ flex: 1, fontSize: 11, color: "var(--text-muted)" }}>{agent.input}</span>
        <span style={{ display: "flex", width: 20, height: 20, alignItems: "center", justifyContent: "center", color: "var(--text-muted)" }}>
          <IconArrowUR style={{ width: 12, height: 12 }} />
        </span>
      </div>
    </div>
  );
}

export function WorkflowSection({
  eyebrow = "Workflow",
  heading = "From discovery to publish, one workflow",
  body = "Each step hands off smoothly, and the agent stays beside you whichever step you are on.",
  tabs = DEFAULT_TABS, agent = DEFAULT_AGENT,
}: WorkflowSectionProps) {
  const [active, setActive] = React.useState(0);
  const reduced = useReducedMotion();
  const item = tabs[active];

  return (
    <section style={{ position: "relative", background: "var(--bg)", padding: "80px 0", overflow: "hidden", fontFamily: "var(--font)" }}>
      <div style={{ maxWidth: 1180, margin: "0 auto", padding: "0 24px" }}>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 48, alignItems: "start", marginBottom: 40 }}>
          <div>
            <p style={{ fontSize: 12, fontWeight: 600, color: "var(--text-subtle)", marginBottom: 12 }}>{eyebrow}</p>
            <h2 style={{ fontSize: 48, lineHeight: 1.05, letterSpacing: "-.02em", fontWeight: 600, color: "var(--text)", maxWidth: 560, margin: 0 }}>{heading}</h2>
          </div>
          <p style={{ fontSize: 17, lineHeight: 1.6, color: "var(--text-subtle)", maxWidth: 460, marginTop: 6 }}>{body}</p>
        </div>

        <div style={{ position: "relative" }}>
          <div style={{ position: "relative", overflow: "hidden", height: 600, borderRadius: 34,
            clipPath: "polygon(0 0, 92% 0, 100% 12%, 100% 100%, 30% 100%, 22% 88%, 0 88%)" }}>
            {tabs.map((t, i) => (
              <div key={t.key} style={{ position: "absolute", inset: 0, background: t.glow, opacity: i === active ? 1 : 0, transition: "opacity .45s" }} />
            ))}
            <div aria-hidden style={{ position: "absolute", inset: 0, opacity: 0.16,
              backgroundImage: `radial-gradient(${ink(40)} 1px, transparent 1px)`, backgroundSize: "28px 28px",
              // taster-allow mask: only the alpha of the gradient is read, the black is never seen
              WebkitMaskImage: "radial-gradient(ellipse at center, #000 30%, transparent 75%)", maskImage: "radial-gradient(ellipse at center, #000 30%, transparent 75%)" }} />
            <div style={{ position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "flex-end", gap: 18, paddingLeft: 300, paddingRight: 36 }}>
              <div key={active} style={{ width: "100%", maxWidth: 360, flexShrink: 1, minWidth: 0, borderRadius: 26, border: "1px solid var(--border)", background: raised(2), padding: 20, animation: `${reduced ? "wfFade" : "wfIn"} .35s ease both` }}>
                <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
                  <h3 style={{ fontSize: 17, fontWeight: 600, letterSpacing: "-.01em", color: "var(--text)", lineHeight: 1.2, margin: 0 }}>{item.heading}</h3>
                  <span style={{ flexShrink: 0, fontSize: 10, fontWeight: 600, color: "var(--text-muted)", border: `1px solid ${ink(18)}`, padding: "3px 8px", borderRadius: 6 }}>{item.badge}</span>
                </div>
                <p style={{ fontSize: 12.5, lineHeight: 1.5, marginTop: 10, color: "var(--text-subtle)" }}>{item.goal}</p>
                <div style={{ marginTop: 16 }}>{item.body}</div>
                <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginTop: 16, paddingTop: 12, borderTop: "1px solid var(--border)", fontSize: 11, color: "var(--text-muted)" }}>
                  <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
                    <span style={{ width: 6, height: 6, borderRadius: 999, background: "var(--text-subtle)" }} />Live pipeline
                  </span>
                  <span>Real-time</span>
                </div>
              </div>
                            <AgentDock agent={agent} />
            </div>
          </div>
          <div style={{ position: "absolute", left: 24, bottom: 56, zIndex: 20, width: 232, border: "1px solid var(--border)", background: raised(4), borderRadius: 24, padding: 12 }}>
            <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
              {tabs.map((tab, i) => {
                const on = active === i; const Icon = tab.icon;
                return (
                  <button key={tab.key} type="button" onClick={() => setActive(i)} aria-current={on ? "step" : undefined}
                    style={{ display: "flex", alignItems: "center", gap: 12, padding: "10px 14px", minHeight: 44, borderRadius: 12, textAlign: "left", cursor: "pointer", transition: "background-color .2s, border-color .2s, color .2s",
                      background: on ? ink(10) : "transparent", border: `1px solid ${on ? ink(22) : "transparent"}` }}>
                    <Icon style={{ width: 20, height: 20, flexShrink: 0, color: on ? "var(--text)" : "var(--text-subtle)" }} />
                    <span style={{ fontSize: 14, fontWeight: 500, color: on ? "var(--text)" : "var(--text-muted)", display: "flex", alignItems: "center" }}>
                      <span style={{ fontSize: 10, fontWeight: 600, marginRight: 6, opacity: .6, fontVariantNumeric: "tabular-nums" }}>{i + 1}</span>
                      {tab.label}
                    </span>
                  </button>
                );
              })}
            </div>
          </div>
        </div>
      </div>
      <style>{`@keyframes wfIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}@keyframes wfFade{from{opacity:0}to{opacity:1}}`}</style>
    </section>
  );
}

export default WorkflowSection;