Skip to content

The open alternative to Salesforce, designed for AI.

1.1 KB
Raw Blame
'use client';

import { styled } from '@linaria/react';
import { DURATION } from '@/tokens';
import { useState } from 'react';

import { HalftoneImageBackdrop } from '@/platform/visuals/rigs/HalftoneImageBackdrop';

import { HERO_BACKDROP } from './hero-backdrop-config';

// Bleeds past the hero's edges so the dash field has no visible seam, and
// fades in only once the first frame has rendered (ported behavior — a
// blank canvas never flashes).
const BackdropMount = styled.div<{ $isReady: boolean }>`
  height: calc(100% + 80px);
  inset: -40px;
  opacity: ${({ $isReady }) => ($isReady ? 1 : 0)};
  pointer-events: none;
  position: absolute;
  transition: opacity ${DURATION.xl} ease;
  width: calc(100% + 80px);
`;

export function HeroBackdrop() {
  const [isReady, setIsReady] = useState(false);

  return (
    <BackdropMount
      $isReady={isReady}
      aria-hidden
      data-illustration="hero-bridge"
    >
      <HalftoneImageBackdrop
        imageUrl={HERO_BACKDROP.imageUrl}
        loading="eager"
        onFirstFrame={() => setIsReady(true)}
        priority
        settings={HERO_BACKDROP.settings}
      />
    </BackdropMount>
  );
}