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

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

Agency Hero Kinetic

Hero агентства с огромным заголовком, последнее слово которого меняется с маркерной подсветкой, CTA, соцдоказательство и стикеры.

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

We build brands people remember.

Volta is an independent studio for brand, web and growth. We turn ambitious companies into the obvious choice in their category.

120+ brands launched since 2016

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

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

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

<AgencyHeroKinetic before="More customers from" words={['Google Ads', 'Meta', 'SEO']} />

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

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

AgencyHeroKinetic.tsx
'use client';

import { useEffect, useRef } from 'react';
import type { CSSProperties } from 'react';
import './AgencyHeroKinetic.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;
}

/**
 * AgencyHeroKinetic — Agency hero with an oversized headline whose last word rotates through a
 * list (highlighted like a marker stroke), intro text, CTAs, client proof and rotating stickers.
 *
 * @param {string} before - Headline text before the rotating word. Default 'We build brands people'.
 * @param {string[]} words - Rotating words. Default ['remember', 'share', 'choose', 'love'].
 * @param {string} text - Intro paragraph.
 * @param {{label: string, href: string}} primary - Main CTA.
 * @param {{label: string, href: string}} secondary - Secondary CTA (optional).
 * @param {{count: string, label: string, people?: string[]}} proof - Client proof with avatar initials.
 * @param {string[]} stickers - Small rotated badges around the headline (max 3).
 * @param {number} interval - Rotation speed in ms. Default 2200.
 * @param {string} variant - Layout (left|centered). Default 'left'.
 * @param {string} size - Type scale (md|lg|xl). Default 'lg'.
 * @param {string} className - Extra class.
 *
 * Accessibility: the h1 contains the full sentence for screen readers (first word); the rotating
 * copy is aria-hidden; rotation stops with prefers-reduced-motion and pauses on hover/focus.
 */
export interface AgencyHeroKineticProps {
  before?: string;
  words?: string[];
  text?: string;
  primary?: { label: string; href: string };
  secondary?: { label: string; href: string };
  proof?: { count: string; label: string; people?: string[] };
  stickers?: string[];
  interval?: number;
  variant?: 'left' | 'centered';
  size?: 'md' | 'lg' | 'xl';
  className?: string;
}

export function AgencyHeroKinetic({
  before = 'We build brands people',
  words = ['remember', 'share', 'choose', 'love'],
  text = 'Volta is an independent studio for brand, web and growth. We turn ambitious companies into the obvious choice in their category.',
  primary = { label: 'Start a project', href: '#contact' },
  secondary = { label: 'See our work', href: '#work' },
  proof = { count: '120+', label: 'brands launched since 2016', people: ['Ana R', 'Ben K', 'Cleo M', 'Dev P'] },
  stickers = ['Brand', 'Web', 'Growth'],
  interval = 2200,
  variant = 'left',
  size = 'lg',
  className = '',
}: AgencyHeroKineticProps) {
  const hues = [80, 280, 20, 190];

  // Client-side behaviour: runs once after mount.
  const mounted = useRef(false);
  useEffect(() => {
    if (mounted.current) return;
    mounted.current = true;
    document.querySelectorAll<HTMLElement>('[data-kinetic]:not([data-bound])').forEach((hero) => {
        hero.dataset.bound = '';
        const words = Array.from(hero.querySelectorAll<HTMLElement>('.ahk__word'));
        if (words.length < 2 || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
        let i = 0;
        let paused = false;
        hero.addEventListener('mouseenter', () => { paused = true; });
        hero.addEventListener('mouseleave', () => { paused = false; });
        hero.addEventListener('focusin', () => { paused = true; });
        hero.addEventListener('focusout', () => { paused = false; });
        window.setInterval(() => {
          if (paused || document.hidden) return;
          words[i].classList.remove('is-active');
          words[i].classList.add('is-leaving');
          const prev = words[i];
          window.setTimeout(() => prev.classList.remove('is-leaving'), 500);
          i = (i + 1) % words.length;
          words[i].classList.add('is-active');
        }, Number(hero.dataset.interval) || 2200);
      });
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);

  return (
    <>
      <div className="cq-agency-hero" data-rk-10d698="">
      <section className={cx(['ahk', `ahk--${variant}`, `ahk--${size}`, className])} data-kinetic data-interval={interval} data-rk-10d698="">
        <div className="ahk__inner" data-rk-10d698="">
          <h1 className="ahk__title" data-rk-10d698="">
            <span data-rk-10d698="">{before} </span>
            <span className="sr-only" data-rk-10d698="">{words[0]}.</span>
            <span className="ahk__rotor" aria-hidden="true" data-rk-10d698="">
              {words.map((w, i) => <span key={i} className={cx(['ahk__word', { 'is-active': i === 0 }])} data-rk-10d698="">{w}</span>)}
            </span>
          </h1>
      
          {stickers.slice(0, 3).map((s, i) => <span key={i} className={cx(['ahk__sticker', `ahk__sticker--${i + 1}`])} aria-hidden="true" data-rk-10d698="">{s}</span>)}
      
          <div className="ahk__foot" data-rk-10d698="">
            {text && <p className="ahk__text" data-rk-10d698="">{text}</p>}
            <div className="ahk__ctas" data-rk-10d698="">
              {primary && <a className="ahk__btn ahk__btn--primary" href={primary.href} data-rk-10d698="">{primary.label}<span aria-hidden="true" data-rk-10d698="">↗</span></a>}
              {secondary && <a className="ahk__btn" href={secondary.href} data-rk-10d698="">{secondary.label}</a>}
            </div>
            {proof && (
              <p className="ahk__proof" data-rk-10d698="">
                {proof.people && (
                  <span className="ahk__faces" aria-hidden="true" data-rk-10d698="">
                    {proof.people.map((p, i) => <span key={i} style={st(`--h: ${hues[i % hues.length]}`)} data-rk-10d698="">{p.split(' ').map((x) => x[0]).join('')}</span>)}
                  </span>
                )}
                <span data-rk-10d698=""><strong data-rk-10d698="">{proof.count}</strong> {proof.label}</span>
              </p>
            )}
          </div>
        </div>
      </section>
      </div>
    </>
  );
}

export default AgencyHeroKinetic;
AgencyHeroKinetic.css
.cq-agency-hero:where([data-rk-10d698]) { container-type: inline-size; }
.ahk:where([data-rk-10d698]) { --fs: clamp(3rem, 10cqi, 8.5rem); position: relative; padding: clamp(3rem, 9cqi, 7rem) clamp(1rem, 4cqi, 2.5rem) clamp(2.5rem, 6cqi, 5rem); color: var(--c-text-1, #fff); overflow: hidden; }
.ahk--md:where([data-rk-10d698]) { --fs: clamp(2.6rem, 8cqi, 6.5rem); }
.ahk--xl:where([data-rk-10d698]) { --fs: clamp(3.4rem, 12cqi, 10.5rem); }
.ahk__inner:where([data-rk-10d698]) { position: relative; max-width: 1280px; margin: 0 auto; }
.ahk--centered:where([data-rk-10d698]) .ahk__inner:where([data-rk-10d698]) { text-align: center; }
.ahk__title:where([data-rk-10d698]) { margin: 0; font-size: var(--fs); font-weight: 900; line-height: 0.92; letter-spacing: -0.06em; text-wrap: balance; }
.ahk__rotor:where([data-rk-10d698]) { position: relative; display: inline-grid; vertical-align: top; }
.ahk__word:where([data-rk-10d698]) {
  grid-area: 1 / 1;
  padding: 0 0.12em;
  border-radius: 0.12em;
  background: var(--agency-accent, var(--c-primary-light, #d4a017));
  color: var(--c-on-primary, #050505);
  opacity: 0;
  transform: translateY(40%) rotate(3deg);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.ahk__word.is-active:where([data-rk-10d698]) { opacity: 1; transform: rotate(-2deg); }
.ahk__word.is-leaving:where([data-rk-10d698]) { opacity: 0; transform: translateY(-40%) rotate(-6deg); }

.ahk__sticker:where([data-rk-10d698]) {
  position: absolute;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  background: var(--c-bg, #050505);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  animation: agency-hero-kinetic-ahk-float 6s ease-in-out infinite;
}
.ahk__sticker--1:where([data-rk-10d698]) { top: -2%; right: 8%; transform: rotate(8deg); }
.ahk__sticker--2:where([data-rk-10d698]) { top: 38%; right: -1%; transform: rotate(-10deg); animation-delay: -2s; background: var(--agency-accent, var(--c-primary-light, #d4a017)); color: var(--c-on-primary, #050505); border-color: transparent; }
.ahk__sticker--3:where([data-rk-10d698]) { top: 18%; right: 26%; transform: rotate(-4deg); animation-delay: -4s; }
@keyframes agency-hero-kinetic-ahk-float { 50% { translate: 0 -8px; } }

.ahk__foot:where([data-rk-10d698]) { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: var(--sp-6, 1.5rem) var(--sp-10, 2.5rem); align-items: end; margin-top: clamp(2rem, 5cqi, 3.5rem); padding-top: var(--sp-6, 1.5rem); border-top: 1.5px solid currentColor; }
.ahk--centered:where([data-rk-10d698]) .ahk__foot:where([data-rk-10d698]) { grid-template-columns: 1fr; justify-items: center; }
.ahk__text:where([data-rk-10d698]) { margin: 0; max-width: 34rem; font-size: 1.1rem; line-height: 1.6; color: var(--c-text-2, #a3a3a3); }
.ahk__ctas:where([data-rk-10d698]) { display: flex; flex-wrap: wrap; gap: var(--sp-2, 0.5rem); }
.ahk__btn:where([data-rk-10d698]) { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 1.6rem; border-radius: 999px; border: 1.5px solid currentColor; color: inherit; font-size: 1rem; font-weight: 800; text-decoration: none; transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease; }
.ahk__btn:hover:where([data-rk-10d698]) { background: var(--c-text-1, #fff); color: var(--c-bg, #050505); }
.ahk__btn--primary:where([data-rk-10d698]) { background: var(--agency-accent, var(--c-primary-light, #d4a017)); border-color: transparent; color: var(--c-on-primary, #050505); }
.ahk__btn--primary:hover:where([data-rk-10d698]) { background: var(--agency-accent, var(--c-primary-light, #d4a017)); color: var(--c-on-primary, #050505); transform: translateY(-2px) rotate(-1.5deg); }
.ahk__btn:focus-visible:where([data-rk-10d698]) { outline: 2px solid var(--agency-accent, var(--c-primary-light, #d4a017)); outline-offset: 3px; }
.ahk__proof:where([data-rk-10d698]) { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-3, 0.75rem); margin: 0; font-size: 0.92rem; color: var(--c-text-2, #a3a3a3); }
.ahk__proof:where([data-rk-10d698]) strong:where([data-rk-10d698]) { color: var(--c-text-1, #fff); }
.ahk__faces:where([data-rk-10d698]) { display: inline-flex; }
.ahk__faces:where([data-rk-10d698]) span:where([data-rk-10d698]) { display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px; border-radius: 50%; border: 2px solid var(--c-bg, #050505); background: hsl(var(--h) 70% 55%); color: #0b0b0b; font-size: 0.7rem; font-weight: 800; }
.ahk__faces:where([data-rk-10d698]) span:first-child:where([data-rk-10d698]) { margin-left: 0; }
.sr-only:where([data-rk-10d698]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@container (max-width: 760px) {
  .ahk__foot:where([data-rk-10d698]) { grid-template-columns: 1fr; }
  .ahk__sticker--1:where([data-rk-10d698]), .ahk__sticker--3:where([data-rk-10d698]) { display: none; }
  .ahk__sticker--2:where([data-rk-10d698]) { top: auto; bottom: 32%; right: 4%; }
}
@media (prefers-reduced-motion: reduce) {
  .ahk__sticker:where([data-rk-10d698]) { animation: none; }
  .ahk__word:where([data-rk-10d698]) { transition: none; }
}