import React from 'react' import { motion, useScroll, useTransform } from 'framer-motion' import { ArrowLeftIcon, ChevronDownIcon } from 'lucide-react' import { ButtonLink } from '../Button' import { useSite } from '../../api' import { useFieldSaver } from '../../admin/AdminContext' import { InlineEdit } from '../admin/InlineEdit' import { SingletonPill } from '../../admin/Editable' export function Hero() { const { brand, hero } = useSite() const save = useFieldSaver() const { scrollY } = useScroll() const imageY = useTransform(scrollY, [0, 700], [0, 110]) const contentY = useTransform(scrollY, [0, 700], [0, -55]) const overlay = useTransform(scrollY, [0, 600], [0.5, 0.78]) const saveHero = (field: string, value: unknown) => save('hero', hero.id, { [field]: value }, (d) => { ;(d.hero as unknown as Record)[field] = value }) // واژه highlight در میانه تیتر با رنگ مسی رندر می‌شود const renderTitle = () => { if (hero.title_highlight && hero.title.includes(hero.title_highlight)) { const [before, ...rest] = hero.title.split(hero.title_highlight) return ( <> {before} {hero.title_highlight} {rest.join(hero.title_highlight)} ) } return hero.title } return (
) }