import {Link} from 'react-router'; import {Image} from '@shopify/hydrogen'; import {motion} from 'motion/react'; import { Beaker, Droplets, Flame, Leaf, PillBottle, type LucideIcon, } from 'lucide-react'; import type { IngredientsIconKey, IngredientsSectionCms, } from '~/lib/ingredients'; import {MOCK_INGREDIENTS_SECTION_CMS} from '~/lib/ingredients'; import {PAGE_TITLE_TYPOGRAPHY_CLASS} from '~/lib/pageTitle'; /** Same file as `React/src/assets/fff9b697e083c70c2aa6491b8a1715c65334534.png` (copied). */ import ingredientsHeroFallbackSrc from '~/assets/ingredients-hero.png'; /** * GROQ: `home` singleton → ingredients philosophy module. * Use with `context.sanity.loadQuery(INGREDIENTS_SECTION_GROQ)` or `useQuery` in the browser. */ export const INGREDIENTS_SECTION_GROQ = `*[_type == "home" && _id == "home"][0].ingredientsSection{ eyebrow, headlineLine1Before, headlineLine1Accent, headlineLine2, body, badgePercent, badgeCaption, primaryCtaLabel, primaryCtaHref, sectionBackground, gold, cream, creamMuted, badgeBackground, charcoal, image{ alt, asset->{ _id, url, metadata{dimensions{width,height}} } }, ingredients[]{ iconKey, name, description } }` as const; export {MOCK_INGREDIENTS_SECTION_CMS}; export type {IngredientsSectionCms}; const ICONS: Record = { leaf: Leaf, flame: Flame, pillBottle: PillBottle, droplets: Droplets, beaker: Beaker, }; function isExternalHref(href: string) { return /^https?:\/\//i.test(href); } function IngredientsHeroImage({cms}: {cms: IngredientsSectionCms}) { const alt = cms.image?.alt ?? 'Ayurvedic ingredients and ritual'; if (cms.image?.url) { const w = cms.image.width ?? 1200; const h = cms.image.height ?? 900; return ( {alt} src ?? ''} sizes="(min-width: 1024px) 525px, 100vw" /> ); } return ( {alt} ); } function PrimaryCta({ href, background, children, }: { href: string; background: string; children: React.ReactNode; }) { const className = 'inline-flex min-h-[51.844px] cursor-pointer items-center justify-center px-[34px] py-[17px] font-["Raleway",sans-serif] text-[14px] font-bold uppercase leading-[19.89px] tracking-[2.3868px] text-white no-underline transition-opacity duration-200 box-border hover:opacity-90'; const style = { boxSizing: 'border-box' as const, background, }; if (isExternalHref(href)) { return ( {children} ); } return ( {children} ); } export type IngredientsProps = { cms: IngredientsSectionCms; }; /** * `React/src/app/components/Ingredients.tsx` — Tailwind + Hydrogen `Image`, CMS-driven. */ export function Ingredients({cms}: IngredientsProps) { const bg = cms.sectionBackground; const gold = cms.gold; const cream = cms.cream; const creamMuted = cms.creamMuted; const badgeBg = cms.badgeBackground; const charcoal = cms.charcoal; return (

{cms.badgePercent}

{cms.badgeCaption}

{cms.eyebrow}

{cms.headlineLine1Before} {cms.headlineLine1Before && (cms.headlineLine1Accent || cms.headlineLine2) ? ' ' : ''} {cms.headlineLine1Accent ? ( {cms.headlineLine1Accent} ) : null} {cms.headlineLine1Accent && cms.headlineLine2 ? ' ' : ''} {cms.headlineLine2}

{cms.body}

    {cms.ingredients.map(({name, description, iconKey}, index) => { const Icon = ICONS[iconKey]; return (

    {name}

    {description}

    ); })}
{cms.primaryCtaLabel}
); }