diff --git a/app/components/challenges/challenge-diagnostic.tsx b/app/components/challenges/challenge-diagnostic.tsx index 14918355..a1bb8c84 100644 --- a/app/components/challenges/challenge-diagnostic.tsx +++ b/app/components/challenges/challenge-diagnostic.tsx @@ -2,12 +2,10 @@ import { css, cx } from '@ocobo/styled-system/css'; import { section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; -import { ButtonLink } from '~/components/ui/button-link'; -import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; +import { ContactCta } from '~/components/ui/contact-cta'; import type { ChallengeDiagnostic as ChallengeDiagnosticData } from '~/modules/challenge-page'; -import { url } from '~/utils/url'; -/** Anchor of the block, the target of the hero CTA. */ +/** Anchor of the block, the target of the experts CTA. */ export const DIAGNOSTIC_ID = 'diagnostic'; type ChallengeDiagnosticProps = { @@ -20,8 +18,6 @@ export function ChallengeDiagnostic({ diagnostic, fallbackCta, }: ChallengeDiagnosticProps) { - const getLocalizedPath = useLocalizedPathname(); - return (
) : null} - - {diagnostic.cta ?? fallbackCta} - + {diagnostic.cta ?? fallbackCta}
); diff --git a/app/components/challenges/challenge-hero.test.tsx b/app/components/challenges/challenge-hero.test.tsx index d3ed4db8..5d08105c 100644 --- a/app/components/challenges/challenge-hero.test.tsx +++ b/app/components/challenges/challenge-hero.test.tsx @@ -27,7 +27,6 @@ function renderHero(data: ChallengeHeroData, challenge: 'sc' | 'ai') { challenge={challenge} name="Sales Compensation" order={3} - hasDiagnostic={false} hasWorkstreams={false} />, { i18nLang: 'en' }, diff --git a/app/components/challenges/challenge-hero.tsx b/app/components/challenges/challenge-hero.tsx index 239795fd..768f001d 100644 --- a/app/components/challenges/challenge-hero.tsx +++ b/app/components/challenges/challenge-hero.tsx @@ -1,4 +1,3 @@ -import { ArrowRight } from 'lucide-react'; import { useId } from 'react'; import { useTranslation } from 'react-i18next'; @@ -7,10 +6,10 @@ import { button, section, text } from '@ocobo/styled-system/recipes'; import { UnifiedBowtie } from '~/components/method/unified-bowtie'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; import type { ChallengeHero as ChallengeHeroData } from '~/modules/challenge-page'; import type { ChallengeKey } from '~/modules/challenge-schema'; -import { DIAGNOSTIC_ID } from './challenge-diagnostic'; import { challengeHeadlineAccent } from './challenge-palette'; import { challengePill } from './challenge-pill'; import { WORKSTREAMS_ID } from './challenge-workstreams'; @@ -27,8 +26,6 @@ type ChallengeHeroProps = { challenge: ChallengeKey; name: string; order: number; - /** Shows the CTA, which scrolls to the diagnostic block. */ - hasDiagnostic: boolean; /** Shows the secondary CTA, which scrolls to the workstreams. */ hasWorkstreams: boolean; }; @@ -38,12 +35,11 @@ export function ChallengeHero({ challenge, name, order, - hasDiagnostic, hasWorkstreams, }: ChallengeHeroProps) { const { t } = useTranslation('challenges'); const titleId = useId(); - const showCta = hero.cta !== null && hasDiagnostic; + const showCta = hero.cta !== null; return (
- {showCta ? ( - - {hero.cta} - - ) : null} + {showCta ? {hero.cta} : null} {hasWorkstreams ? ( ({ + transitionDelay: `${(0.2 + index * 0.3 + offset).toFixed(1)}s`, +}); + +const typingDot = css({ + w: '[5px]', + h: '[5px]', + rounded: 'full', + bg: 'gray.300', + animation: 'typing-dot', +}); + // The windows draw a small app UI: the mockup sets them at 11 to 12px, under // the six v2 sizes, so they use the `xs` and `label` font sizes. const windowFrame = css({ @@ -133,11 +179,17 @@ function AgentWindow({ children: ReactNode; }) { const { t } = useTranslation('home'); + const { ref, inView } = useInView({ + rootMargin: '0px', + threshold: 0.45, + }); return ( -
@@ -208,7 +260,7 @@ function AgentWindow({ {t(`ai.agents.${agent}.caption`)}

-
+ ); } @@ -242,7 +294,9 @@ export function AiAgentWindows() { {accounts.map((account, index) => (
  • + > + + {account.signal} @@ -289,10 +351,12 @@ export function AiAgentWindows() {
    - {fields.map((field) => ( + {fields.map((field, index) => (
    - {points.map((point) => ( -
  • + {points.map((point, index) => ( +
  • {point.name} {' '} @@ -380,10 +444,30 @@ export function AiAgentWindows() { {t('ai.agents.insight.meta')}

    -

    + +

    {t('ai.agents.insight.message')}

    -
    +
    {actions.map((action, index) => ( (STEP_THRESHOLDS); return (
    -
    +
      +
    1. {layer.line ? ( - -
      - - {copy.label} - -

      - {copy.title} -

      -

      - {copy.description} -

      -
        - {layer.tools.map((name) => ( -
      • - - {name} -
      • - ))} -
      -
      -
      +
      + + {copy.label} + +

      + {copy.title} +

      +

      + {copy.description} +

      +
        + {layer.tools.map((name) => ( +
      • + + {name} +
      • + ))} +
      +
    2. ); })} @@ -307,6 +334,7 @@ export function AiSection({ aiChallengeSlug }: AiSectionProps) { className={cx( text({ variant: 'small', color: 'white' }), css({ color: 'white/50', mt: '3', ml: '14' }), + stepClass(reached, animate, LAYERS.length), )} > {t('ai.layersCaption')} diff --git a/app/components/home/challenges-section.tsx b/app/components/home/challenges-section.tsx index 918df8f4..00402c94 100644 --- a/app/components/home/challenges-section.tsx +++ b/app/components/home/challenges-section.tsx @@ -1,15 +1,19 @@ import { Trans, useTranslation } from 'react-i18next'; import { css, cx } from '@ocobo/styled-system/css'; -import { button, card, section, text } from '@ocobo/styled-system/recipes'; +import { card, section, text } from '@ocobo/styled-system/recipes'; import { UnifiedBowtie } from '~/components/method/unified-bowtie'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; import type { HomeChallengeCard } from '~/modules/home-challenges'; import { HomeChallengeCards } from './home-challenge-cards'; -/** Target of the final call to action, which the start panel links to. */ +/** + * Id of the final call to action. No home link targets it any more, but it + * keeps `/#diagnostic` links from outside working and gives the e2e test hook. + */ export const DIAGNOSTIC_ID = 'diagnostic'; /** Target of the hero's "challenges" call to action. */ @@ -89,12 +93,7 @@ export function ChallengesSection({ challenges }: ChallengesSectionProps) { {t('challenges.start.text')}

    -
    - {t('challenges.start.cta')} - + {t('challenges.start.cta')}
  • diff --git a/app/components/home/comparatif-section.tsx b/app/components/home/comparatif-section.tsx index bee94beb..893b66b0 100644 --- a/app/components/home/comparatif-section.tsx +++ b/app/components/home/comparatif-section.tsx @@ -1,11 +1,11 @@ import { useTranslation } from 'react-i18next'; import { css, cx } from '@ocobo/styled-system/css'; -import { button, section, text } from '@ocobo/styled-system/recipes'; +import { section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; -import { DIAGNOSTIC_ID } from './challenges-section'; import { ComparatifGap } from './comparatif-gap'; /** @@ -44,12 +44,9 @@ export function ComparatifSection() {
    - + {t('comparatif.cta')} - +
    diff --git a/app/components/home/cta-section.tsx b/app/components/home/cta-section.tsx index 9b9f9cf2..327119e0 100644 --- a/app/components/home/cta-section.tsx +++ b/app/components/home/cta-section.tsx @@ -17,7 +17,7 @@ interface CtaSectionProps { subtitle?: string; ctaText: string; ctaLink: string; - /** Anchor target, for example the hero's `#diagnostic` link. */ + /** Anchor target, for example `#diagnostic` on the home. */ id?: string; } diff --git a/app/components/home/dashboard-illustration.tsx b/app/components/home/dashboard-illustration.tsx index e04b0c82..df89675a 100644 --- a/app/components/home/dashboard-illustration.tsx +++ b/app/components/home/dashboard-illustration.tsx @@ -1,33 +1,107 @@ -import { css } from '@ocobo/styled-system/css'; +import { css, cx } from '@ocobo/styled-system/css'; import { center } from '@ocobo/styled-system/patterns'; +import { useInView } from '~/hooks/use-in-view'; + +// The `smooth` easing token: `animation` shorthands cannot reference tokens. +const easeOut = 'cubic-bezier(0.2, 0.8, 0.2, 1)'; +const easeBack = 'cubic-bezier(0.2, 0.8, 0.2, 1.3)'; + +// The mockup `#mission` illustration. Once a quarter of it is in view, the +// shapes pop, the windows rise, then their content grows and the wave draws +// itself. On hover the windows drift apart and the shapes swell. +const box = css({ + position: 'relative', + w: 'full', + maxW: '[580px]', + aspectRatio: 'square', + '& .il-w': { + transitionProperty: '[transform]', + transitionDuration: 'slower', + transitionTimingFunction: 'smooth', + }, + // Keeps the mint circle's own 1s hover rotation, which this rule overrides. + '& .il-s': { transition: `[scale 0.4s ${easeBack}, transform 1s ease]` }, + '& .il-ln, & .il-bar, & .il-pie': { transformBox: 'fill-box' }, + '& .il-ln': { transformOrigin: 'left center' }, + '& .il-bar': { transformOrigin: 'center bottom' }, + '& .il-pie': { transformOrigin: 'center' }, + '& .il-wave': { strokeDasharray: '1' }, + // No hover drift under reduced motion. + _motionSafe: { + '&:hover .il-w1': { transform: 'translate(-4px, -6px)' }, + '&:hover .il-w2': { transform: 'translate(5px, -8px)' }, + '&:hover .il-w3': { transform: 'translate(6px, 4px)' }, + '&:hover .il-w4': { transform: 'translate(0px, -5px)' }, + '&:hover .il-w5': { transform: 'translate(-5px, 3px)' }, + '&:hover .il-s': { scale: '[1.08]' }, + }, +}); + +const waiting = css({ '& .il-s, & .il-w': { opacity: '0' } }); + +const playing = css({ + '& .il-s': { animation: `[il-pop 0.7s ${easeBack} backwards]` }, + '& .il-s1': { animationDelay: '[0.1s]' }, + '& .il-s2': { animationDelay: '[0.25s]' }, + '& .il-s3': { animationDelay: '[0.4s]' }, + '& .il-s4': { animationDelay: '[0.55s]' }, + '& .il-w': { animation: `[il-up 0.7s ${easeOut} backwards]` }, + '& .il-w1': { animationDelay: '[0.3s]' }, + '& .il-w2': { animationDelay: '[0.45s]' }, + '& .il-w3': { animationDelay: '[0.6s]' }, + '& .il-w4': { animationDelay: '[0.75s]' }, + '& .il-w5': { animationDelay: '[0.9s]' }, + '& .il-ln': { animation: `[il-x 0.6s ${easeOut} backwards]` }, + '& .il-ln:nth-of-type(1)': { animationDelay: '[0.9s]' }, + '& .il-ln:nth-of-type(2)': { animationDelay: '[1.0s]' }, + '& .il-ln:nth-of-type(3)': { animationDelay: '[1.1s]' }, + '& .il-ln:nth-of-type(4)': { animationDelay: '[1.2s]' }, + '& .il-ln:nth-of-type(5)': { animationDelay: '[1.3s]' }, + '& .il-bar': { + animation: '[il-y 0.6s cubic-bezier(0.2, 0.8, 0.2, 1.2) backwards]', + }, + '& .il-bar:nth-of-type(1)': { animationDelay: '[1.3s]' }, + '& .il-bar:nth-of-type(2)': { animationDelay: '[1.4s]' }, + '& .il-bar:nth-of-type(3)': { animationDelay: '[1.5s]' }, + '& .il-bar:nth-of-type(4)': { animationDelay: '[1.6s]' }, + '& .il-bar:nth-of-type(5)': { animationDelay: '[1.7s]' }, + '& .il-pie': { animation: `[il-pie 1s ${easeOut} 1s backwards]` }, + '& .il-wave': { animation: '[il-draw 1.4s ease 1.3s backwards]' }, + '& .il-wave2': { animation: '[il-fade 0.8s ease 1.9s backwards]' }, + _motionReduce: { + '& .il-s, & .il-w, & .il-ln, & .il-bar, & .il-pie, & .il-wave, & .il-wave2': + { animation: '[none]', opacity: '1' }, + }, +}); + export const DashboardIllustration = () => { + // `inView` starts true, so the server render shows the final state. + const { ref, inView } = useInView({ + rootMargin: '0px', + threshold: 0.25, + }); + return ( -
    +
    {
    { })} fill="none" > - - - - - - - - + + - - - - + + + + + + + + + + + + - - - - - - - - + + - - - - - - - - - - + + - - - + + + + + + + + + + - - - - - + + - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + diff --git a/app/components/home/home-hero.tsx b/app/components/home/home-hero.tsx index e32f7c39..48db97b2 100644 --- a/app/components/home/home-hero.tsx +++ b/app/components/home/home-hero.tsx @@ -1,4 +1,4 @@ -import { ArrowRight, Pause, Play } from 'lucide-react'; +import { Pause, Play } from 'lucide-react'; import { memo } from 'react'; import { Trans, useTranslation } from 'react-i18next'; @@ -6,6 +6,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { button, section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; import { CHALLENGES_ID } from './challenges-section'; import { SETTLED_FRAME, heroFrame } from './home-hero-frame'; @@ -169,14 +170,9 @@ export function HomeHero({ {t('heroV2.cta.challenges')} ) : null} - + {t('heroV2.cta.diagnostic')} - +
    diff --git a/app/components/home/interventions-section.tsx b/app/components/home/interventions-section.tsx index a891986a..08522b38 100644 --- a/app/components/home/interventions-section.tsx +++ b/app/components/home/interventions-section.tsx @@ -47,7 +47,7 @@ export const InterventionsSection = () => {
    diff --git a/app/components/ui/button-link.tsx b/app/components/ui/button-link.tsx index 98335a08..d2b9ba90 100644 --- a/app/components/ui/button-link.tsx +++ b/app/components/ui/button-link.tsx @@ -24,7 +24,7 @@ export const ButtonLink = ({ return ( {children} - + ); }; diff --git a/app/components/ui/contact-cta.test.tsx b/app/components/ui/contact-cta.test.tsx new file mode 100644 index 00000000..2b2a73a7 --- /dev/null +++ b/app/components/ui/contact-cta.test.tsx @@ -0,0 +1,39 @@ +import { describe, expect, it } from 'vitest'; + +import { render, screen } from '~/test/utils'; + +import { ContactCta } from './contact-cta'; + +describe('ContactCta', () => { + it('opens the French contact page on a French page', async () => { + render(, { + initialEntries: ['/fr/challenges/x'], + path: ':lang/*', + i18nLang: 'fr', + }); + + expect( + await screen.findByRole('link', { name: 'Échanger avec un architecte' }), + ).toHaveAttribute('href', '/fr/contact'); + }); + + it('opens the French contact page on the unprefixed home', async () => { + render(, { initialEntries: ['/'], i18nLang: 'fr' }); + + expect( + await screen.findByRole('link', { name: 'Échanger avec un architecte' }), + ).toHaveAttribute('href', '/fr/contact'); + }); + + it('opens the English contact page on an English page', async () => { + render(Talk to one of us, { + initialEntries: ['/en'], + path: ':lang/*', + i18nLang: 'en', + }); + + expect( + await screen.findByRole('link', { name: 'Talk to one of us' }), + ).toHaveAttribute('href', '/en/contact'); + }); +}); diff --git a/app/components/ui/contact-cta.tsx b/app/components/ui/contact-cta.tsx new file mode 100644 index 00000000..688257d2 --- /dev/null +++ b/app/components/ui/contact-cta.tsx @@ -0,0 +1,42 @@ +import { useTranslation } from 'react-i18next'; + +import type { ButtonVariantProps } from '@ocobo/styled-system/recipes/button'; + +import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; +import { url } from '~/utils/url'; + +import { ButtonLink } from './button-link'; + +type ContactCtaProps = ButtonVariantProps & { + /** Label of the button; "Talk to an architect" when left out. */ + children?: React.ReactNode; + className?: string; + 'data-testid'?: string; +}; + +/** + * The "Talk to an architect" button. It always opens the contact page in the + * current language, never an anchor further down the page. + */ +export function ContactCta({ + children, + variant = 'primary', + size, + className, + 'data-testid': testId, +}: ContactCtaProps) { + const { t } = useTranslation('common'); + const getLocalizedPath = useLocalizedPathname(); + + return ( + + {children ?? t('navigation.cta')} + + ); +} diff --git a/app/hooks/use-scroll-steps.test.ts b/app/hooks/use-scroll-steps.test.ts new file mode 100644 index 00000000..58219652 --- /dev/null +++ b/app/hooks/use-scroll-steps.test.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from 'vitest'; + +import { countReached, scrollStepProgress } from './use-scroll-steps'; + +describe('scrollStepProgress', () => { + it('is -1 while the top sits below 80% of the viewport', () => { + expect(scrollStepProgress(900, 1000)).toBe(-1); + expect(scrollStepProgress(801, 1000)).toBe(-1); + }); + + it('runs from 0 to 1 over the next half viewport', () => { + expect(scrollStepProgress(800, 1000)).toBe(0); + expect(scrollStepProgress(550, 1000)).toBe(0.5); + expect(scrollStepProgress(300, 1000)).toBe(1); + }); + + it('caps at 1 once scrolled past', () => { + expect(scrollStepProgress(-200, 1000)).toBe(1); + }); +}); + +describe('countReached', () => { + const thresholds = [0.04, 0.38, 0.7, 0.85]; + + it('counts no step before the first threshold', () => { + expect(countReached(thresholds, -1)).toBe(0); + expect(countReached(thresholds, 0.03)).toBe(0); + }); + + it('counts a threshold reached exactly', () => { + expect(countReached(thresholds, 0.38)).toBe(2); + }); + + it('counts every step at the end', () => { + expect(countReached(thresholds, 1)).toBe(4); + }); +}); diff --git a/app/hooks/use-scroll-steps.ts b/app/hooks/use-scroll-steps.ts new file mode 100644 index 00000000..e80f5fc2 --- /dev/null +++ b/app/hooks/use-scroll-steps.ts @@ -0,0 +1,94 @@ +import { + type RefObject, + useEffect, + useLayoutEffect, + useRef, + useState, +} from 'react'; + +import { + matchesReducedMotion, + usePrefersReducedMotion, +} from './use-prefers-reduced-motion'; + +// useLayoutEffect warns on the server; it never runs there anyway. +const useIsomorphicLayoutEffect = + typeof window === 'undefined' ? useEffect : useLayoutEffect; + +/** + * Scroll progress of an element, as the mockup computes it: -1 while its top + * sits below 80% of the viewport, then 0 to 1 over the next half viewport. + */ +export function scrollStepProgress(top: number, viewportHeight: number) { + const progress = (viewportHeight * 0.8 - top) / (viewportHeight * 0.5); + if (progress < 0) return -1; + return Math.min(progress, 1); +} + +/** Number of thresholds, sorted ascending, that `progress` has reached. */ +export function countReached(thresholds: readonly number[], progress: number) { + return thresholds.filter((threshold) => progress >= threshold).length; +} + +type UseScrollStepsResult = { + ref: RefObject; + /** + * How many steps are shown, or null when every step shows: on the server, + * under reduced motion, and before hydration. + */ + reached: number | null; + /** + * False until the first measure has painted, so the steps the visitor + * cannot reach yet are hidden at once instead of fading out. + */ + animate: boolean; +}; + +/** + * Reveals steps one by one as the visitor scrolls an element into view, and + * hides them again when scrolling back up (the mockup `#ia8` scrub). + * `thresholds` must be sorted ascending and keep the same values. + */ +export function useScrollSteps( + thresholds: readonly number[], +): UseScrollStepsResult { + const ref = useRef(null); + const [reached, setReached] = useState(null); + const [animate, setAnimate] = useState(false); + const prefersReducedMotion = usePrefersReducedMotion(); + const thresholdsRef = useRef(thresholds); + + useIsomorphicLayoutEffect(() => { + const element = ref.current; + if (!element || prefersReducedMotion || matchesReducedMotion()) { + setReached(null); + return; + } + + let frame = 0; + const update = () => { + frame = 0; + const progress = scrollStepProgress( + element.getBoundingClientRect().top, + window.innerHeight, + ); + setReached(countReached(thresholdsRef.current, progress)); + }; + const onScroll = () => { + if (!frame) frame = window.requestAnimationFrame(update); + }; + + update(); + const settle = window.requestAnimationFrame(() => setAnimate(true)); + window.addEventListener('scroll', onScroll, { passive: true }); + window.addEventListener('resize', onScroll); + return () => { + window.removeEventListener('scroll', onScroll); + window.removeEventListener('resize', onScroll); + window.cancelAnimationFrame(settle); + if (frame) window.cancelAnimationFrame(frame); + }; + }, [prefersReducedMotion]); + + return { ref, reached, animate }; +} diff --git a/app/routes/_main.($lang).challenges.$slug.test.tsx b/app/routes/_main.($lang).challenges.$slug.test.tsx index 50d36bed..e50109ae 100644 --- a/app/routes/_main.($lang).challenges.$slug.test.tsx +++ b/app/routes/_main.($lang).challenges.$slug.test.tsx @@ -364,7 +364,7 @@ describe('challenge page', () => { name: 'Make my forecast reliable', }); expect(ctas.map((cta) => cta.getAttribute('href'))).toEqual([ - '#diagnostic', + '/en/contact', '/en/contact', ]); }); @@ -434,7 +434,7 @@ describe('challenge page', () => { expect(screen.queryByText('[Step]')).not.toBeInTheDocument(); }); - it('drops the hero CTA when the diagnostic block is absent', () => { + it('keeps the hero CTA on the contact page when the diagnostic block is absent', () => { const { frontmatter } = fixture; renderPage({ ...frontmatter, @@ -443,10 +443,10 @@ describe('challenge page', () => { expect(document.getElementById('diagnostic')).toBeNull(); expect( - screen.queryByRole('link', { name: 'Make my forecast reliable' }), - ).not.toBeInTheDocument(); + screen.getByRole('link', { name: 'Make my forecast reliable' }), + ).toHaveAttribute('href', '/en/contact'); expect(screen.queryByText('[Question]')).not.toBeInTheDocument(); - // The workstreams CTA stays, alone and secondary. + // The workstreams CTA stays, secondary. expect(screen.getByRole('link', { name: 'What we build' })).toHaveAttribute( 'href', '#chantiers', diff --git a/app/routes/_main.($lang).challenges.$slug.tsx b/app/routes/_main.($lang).challenges.$slug.tsx index ca48c9a7..0b34d157 100644 --- a/app/routes/_main.($lang).challenges.$slug.tsx +++ b/app/routes/_main.($lang).challenges.$slug.tsx @@ -111,7 +111,6 @@ export default function ChallengeRoute() { challenge={page.key} name={page.name} order={page.order} - hasDiagnostic={page.diagnostic !== null} hasWorkstreams={page.workstreams !== null} /> {page.symptoms ? ( diff --git a/e2e/homepage.spec.ts b/e2e/homepage.spec.ts index 5a710c64..442c0c27 100644 --- a/e2e/homepage.spec.ts +++ b/e2e/homepage.spec.ts @@ -13,11 +13,11 @@ test.describe('homepage golden path', () => { ).toBeVisible(); }); - test('primary CTA leads to the diagnostic block', async ({ page }) => { + test('primary CTA leads to the contact page', async ({ page }) => { await page.goto('/'); const cta = page.getByTestId('hero-cta'); await expect(cta).toBeVisible(); - await expect(cta).toHaveAttribute('href', '#diagnostic'); + await expect(cta).toHaveAttribute('href', /\/contact$/); await expect(page.getByTestId('diagnostic-cta')).toHaveAttribute( 'href', /\/contact/, diff --git a/preset/keyframes.ts b/preset/keyframes.ts index 5181b4e2..4a6a8c64 100644 --- a/preset/keyframes.ts +++ b/preset/keyframes.ts @@ -69,10 +69,6 @@ export const keyframes = defineKeyframes({ from: { opacity: '0', transform: 'translateY(15px)' }, to: { opacity: '1', transform: 'translateY(0)' }, }, - 'hero-reveal': { - from: { opacity: '0', transform: 'translateY(15px)' }, - to: { opacity: '1', transform: 'translateY(0)' }, - }, 'gentle-reveal': { '0%': { opacity: '0', transform: 'translateY(10px)' }, '100%': { opacity: '1', transform: 'translateY(0)' }, @@ -147,4 +143,43 @@ export const keyframes = defineKeyframes({ '0%': { transform: 'scale(1)', opacity: '0.8' }, '100%': { transform: 'scale(2.5)', opacity: '0' }, }, + // Mission illustration (the mockup `#mission`): on appearance the shapes pop, + // the windows rise, then their content grows and the wave draws itself. + 'il-pop': { + from: { opacity: '0', scale: '0.3' }, + to: { opacity: '1', scale: '1' }, + }, + 'il-up': { + from: { opacity: '0', transform: 'translateY(48px)' }, + to: { opacity: '1', transform: 'none' }, + }, + 'il-x': { + from: { transform: 'scaleX(0)' }, + to: { transform: 'scaleX(1)' }, + }, + 'il-y': { + from: { transform: 'scaleY(0)' }, + to: { transform: 'scaleY(1)' }, + }, + 'il-pie': { + from: { opacity: '0', transform: 'rotate(-120deg) scale(0.5)' }, + to: { opacity: '1', transform: 'none' }, + }, + 'il-draw': { + from: { strokeDashoffset: '1' }, + to: { strokeDashoffset: '0' }, + }, + 'il-fade': { + from: { opacity: '0' }, + to: { opacity: '1' }, + }, + // Agent windows of the home AI block: the typing dots bounce, then + // collapse once the message arrives. + 'typing-dot': { + '0%, 100%': { opacity: '0.3', transform: 'none' }, + '50%': { opacity: '1', transform: 'translateY(-2px)' }, + }, + 'typing-hide': { + to: { height: '0', margin: '0', opacity: '0', overflow: 'hidden' }, + }, }); diff --git a/preset/recipes/button.ts b/preset/recipes/button.ts index e2a6e604..8deb3138 100644 --- a/preset/recipes/button.ts +++ b/preset/recipes/button.ts @@ -3,7 +3,7 @@ import { defineRecipe } from '@pandacss/dev'; export const button = defineRecipe({ className: 'button', description: 'Button component styles', - jsx: ['ButtonLink'], + jsx: ['ButtonLink', 'ContactCta'], base: { display: 'inline-flex', alignItems: 'center', diff --git a/preset/tokens/index.ts b/preset/tokens/index.ts index b1e36499..6961de51 100644 --- a/preset/tokens/index.ts +++ b/preset/tokens/index.ts @@ -85,6 +85,8 @@ export const tokens = defineTokens({ 'float-cursor': { value: 'float-cursor 5s infinite ease-in-out' }, 'float-very-slow': { value: 'float-very-slow 12s ease-in-out infinite' }, 'float-gentle': { value: 'float-gentle 8s ease-in-out infinite' }, + // One bounce: the dots collapse 0.9s after the window shows (`typing-hide`). + 'typing-dot': { value: 'typing-dot 1s ease-in-out' }, 'float-grid': { value: 'float-grid 6s ease-in-out infinite' }, 'float-blob': { value: 'float-blob 12s infinite ease-in-out' }, 'slow-fade': { value: 'slow-fade 6s infinite ease-in-out' }, @@ -95,9 +97,6 @@ export const tokens = defineTokens({ value: 'fade-in-up-small 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', }, - 'hero-reveal': { - value: 'hero-reveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', - }, 'gentle-reveal': { value: 'gentle-reveal 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', },