1 звезда на GitHub = 1 новый компонент.

Поставить звезду
Агентство и маркетинг

Agency Process Steps

Таймлайн «Как мы работаем»: нумерованные этапы со сроками, соединённые линией, заполняющейся при прокрутке.

processtimelinestepsagency
Живое превью

How we work

From audit to growth in four steps

  1. Week 0

    Free audit

    We review your ads, site and search presence and show you the biggest opportunities.

  2. Week 1

    Growth plan

    A 90-day plan with targets, budget, channels and the first experiments.

  3. Weeks 2–4

    Launch

    Tracking, campaigns, content and pages go live with the team that planned them.

  4. Ongoing

    Optimise

    Weekly tests, monthly reviews and budget that follows what is working.

Использование

Скопируйте и вставьте этот код в ваш React-компонент:

tsx
import { AgencyProcessSteps } from 'react-component-kit-ui/sections';

<AgencyProcessSteps steps={[{ title: 'Audit', text: 'We size the opportunity.', duration: 'Week 1' }, { title: 'Launch', text: 'Campaigns go live.', duration: 'Week 2' }]} />

Ручная установка

Если вы не используете пакет npm, создайте файл и вставьте следующий код: src/components/sections/AgencyProcessSteps.tsx + AgencyProcessSteps.css:

AgencyProcessSteps.tsx
'use client';

import { useEffect, useRef } from 'react';
import type { CSSProperties } from 'react';
import './AgencyProcessSteps.css';

/** class:list → className */
function cx(...args: unknown[]): string {
  const out: string[] = [];
  const walk = (v: unknown) => {
    if (!v) return;
    if (typeof v === 'string' || typeof v === 'number') out.push(String(v));
    else if (Array.isArray(v)) v.forEach(walk);
    else if (typeof v === 'object') for (const [k, on] of Object.entries(v as Record<string, unknown>)) if (on) out.push(k);
  };
  args.forEach(walk);
  return out.join(' ');
}

/** "a: b; --c: d" → style object */
function st(css: string | undefined): CSSProperties {
  const o: Record<string, string> = {};
  for (const decl of String(css ?? '').split(';')) {
    const i = decl.indexOf(':');
    if (i < 0) continue;
    const k = decl.slice(0, i).trim();
    if (k) o[k.startsWith('--') ? k : k.replace(/-([a-z])/g, (_, c) => c.toUpperCase())] = decl.slice(i + 1).trim();
  }
  return o as CSSProperties;
}

/**
 * AgencyProcessSteps — "How we work" timeline: numbered phases with duration chips joined by a
 * line that fills as the section scrolls into view. Horizontal on wide containers, vertical on narrow.
 *
 * @param {string} eyebrow - Small label. Default 'How we work'.
 * @param {string} title - Heading. Default 'From audit to growth in four steps'.
 * @param {Array<{title: string, text: string, duration?: string}>} steps - Phases (3–5 work best).
 * @param {{label: string, href: string}} cta - Optional call to action under the steps.
 * @param {string} className - Extra class.
 *
 * Accessibility: an ordered list; the progress line is decorative and does not animate with
 * reduced motion.
 */
export interface AgencyProcessStepsProps {
  eyebrow?: string;
  title?: string;
  steps?: Array<{ title: string; text: string; duration?: string }>;
  cta?: { label: string; href: string };
  className?: string;
}

export function AgencyProcessSteps({
  eyebrow = 'How we work',
  title = 'From audit to growth in four steps',
  steps = [
    { title: 'Free audit', text: 'We review your ads, site and search presence and show you the biggest opportunities.', duration: 'Week 0' },
    { title: 'Growth plan', text: 'A 90-day plan with targets, budget, channels and the first experiments.', duration: 'Week 1' },
    { title: 'Launch', text: 'Tracking, campaigns, content and pages go live with the team that planned them.', duration: 'Weeks 2–4' },
    { title: 'Optimise', text: 'Weekly tests, monthly reviews and budget that follows what is working.', duration: 'Ongoing' },
  ],
  cta,
  className = '',
}: AgencyProcessStepsProps) {

  // Client-side behaviour: runs once after mount.
  const mounted = useRef(false);
  useEffect(() => {
    if (mounted.current) return;
    mounted.current = true;
    document.querySelectorAll<HTMLElement>('[data-process]:not([data-bound])').forEach((el) => {
        el.dataset.bound = '';
        if (!('IntersectionObserver' in window)) { el.classList.add('is-in'); return; }
        const io = new IntersectionObserver((entries) => {
          if (entries.some((e) => e.isIntersecting)) { el.classList.add('is-in'); io.disconnect(); }
        }, { threshold: 0.3 });
        io.observe(el);
      });
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);

  return (
    <>
      <div className="aps-cq" data-rk-2ce2eb="">
      <section className={cx(['aps', className])} data-process data-rk-2ce2eb="">
        <header className="aps__head" data-rk-2ce2eb="">
          {eyebrow && <p className="aps__eyebrow" data-rk-2ce2eb="">{eyebrow}</p>}
          <h2 className="aps__title" data-rk-2ce2eb="">{title}</h2>
        </header>
        <div className="aps__wrap" data-rk-2ce2eb="">
        <span className="aps__line" aria-hidden="true" data-rk-2ce2eb=""><span data-rk-2ce2eb=""></span></span>
        <ol className="aps__list" style={st(`--n: ${steps.length}`)} data-rk-2ce2eb="">
          {steps.map((s, i) => (
            <li key={i} className="aps__step" style={st(`--i: ${i}`)} data-rk-2ce2eb="">
              <span className="aps__dot" aria-hidden="true" data-rk-2ce2eb="">{String(i + 1).padStart(2, '0')}</span>
              {s.duration && <span className="aps__time" data-rk-2ce2eb="">{s.duration}</span>}
              <h3 className="aps__name" data-rk-2ce2eb="">{s.title}</h3>
              <p className="aps__text" data-rk-2ce2eb="">{s.text}</p>
            </li>
          ))}
        </ol>
        </div>
        {cta && <a className="aps__cta" href={cta.href} data-rk-2ce2eb="">{cta.label}<span aria-hidden="true" data-rk-2ce2eb="">→</span></a>}
      </section>
      </div>
    </>
  );
}

export default AgencyProcessSteps;
AgencyProcessSteps.css
.aps-cq:where([data-rk-2ce2eb]) { container-type: inline-size; }
.aps:where([data-rk-2ce2eb]) { color: var(--c-text-1, #fff); }
.aps__head:where([data-rk-2ce2eb]) { margin-bottom: clamp(2rem, 5cqi, 3.5rem); }
.aps__eyebrow:where([data-rk-2ce2eb]) { margin: 0 0 var(--sp-3, 0.75rem); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-text-2, #a3a3a3); }
.aps__title:where([data-rk-2ce2eb]) { margin: 0; max-width: 18ch; font-size: clamp(2rem, 5cqi, 3.8rem); font-weight: 900; line-height: 1; letter-spacing: -0.05em; text-wrap: balance; }
.aps__wrap:where([data-rk-2ce2eb]) { position: relative; }
.aps__list:where([data-rk-2ce2eb]) { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: clamp(1rem, 3cqi, 2rem); margin: 0; padding: 0; list-style: none; }
.aps__line:where([data-rk-2ce2eb]) { position: absolute; top: 27px; left: 28px; right: 28px; height: 2px; background: var(--c-border, rgba(255, 255, 255, 0.14)); }
.aps__line:where([data-rk-2ce2eb]) span:where([data-rk-2ce2eb]) { display: block; height: 100%; width: 100%; background: var(--agency-accent, var(--c-primary-light, #d4a017)); transform: scaleX(0); transform-origin: left; transition: transform 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.2s; }
.is-in:where([data-rk-2ce2eb]) .aps__line:where([data-rk-2ce2eb]) span:where([data-rk-2ce2eb]) { transform: scaleX(1); }
.aps__step:where([data-rk-2ce2eb]) { position: relative; display: flex; flex-direction: column; gap: var(--sp-3, 0.75rem); }
.aps__dot:where([data-rk-2ce2eb]) { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--c-text-1, #fff); background: var(--c-bg, #050505); font-weight: 900; font-variant-numeric: tabular-nums; transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease; transition-delay: calc(0.3s + var(--i) * 0.35s); }
.is-in:where([data-rk-2ce2eb]) .aps__dot:where([data-rk-2ce2eb]) { background: var(--agency-accent, var(--c-primary-light, #d4a017)); border-color: transparent; color: var(--c-on-primary, #050505); }
.aps__time:where([data-rk-2ce2eb]) { align-self: flex-start; padding: 0.25rem 0.65rem; border-radius: 999px; background: rgb(var(--ink-rgb, 255 255 255) / 0.07); font-size: 0.78rem; font-weight: 800; color: var(--c-text-2, #a3a3a3); }
.aps__name:where([data-rk-2ce2eb]) { margin: 0; font-size: 1.5rem; font-weight: 900; letter-spacing: -0.035em; }
.aps__text:where([data-rk-2ce2eb]) { margin: 0; line-height: 1.6; color: var(--c-text-2, #a3a3a3); }
.aps__cta:where([data-rk-2ce2eb]) { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; margin-top: clamp(1.75rem, 4cqi, 2.75rem); padding: 0 1.4rem; border-radius: 999px; border: 1.5px solid currentColor; color: inherit; font-weight: 800; text-decoration: none; }
.aps__cta:hover:where([data-rk-2ce2eb]) { background: var(--c-text-1, #fff); color: var(--c-bg, #050505); }
.aps__cta:focus-visible:where([data-rk-2ce2eb]) { outline: 2px solid var(--agency-accent, var(--c-primary-light, #d4a017)); outline-offset: 3px; }

@container (max-width: 760px) {
  .aps__list:where([data-rk-2ce2eb]) { grid-template-columns: 1fr; gap: var(--sp-6, 1.5rem); padding-left: 76px; }
  .aps__line:where([data-rk-2ce2eb]) { top: 28px; bottom: 28px; left: 27px; right: auto; width: 2px; height: auto; }
  .aps__line:where([data-rk-2ce2eb]) span:where([data-rk-2ce2eb]) { transform: scaleY(0); transform-origin: top; }
  .is-in:where([data-rk-2ce2eb]) .aps__line:where([data-rk-2ce2eb]) span:where([data-rk-2ce2eb]) { transform: scaleY(1); }
  .aps__dot:where([data-rk-2ce2eb]) { position: absolute; left: -76px; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .aps__line:where([data-rk-2ce2eb]) span:where([data-rk-2ce2eb]), .aps__dot:where([data-rk-2ce2eb]) { transition: none; }
}