import { useMemo, useRef, useState } from "react"; import type { BuilderFormData, SiteBuilderMetadata, StylePreferences, } from "../../../../types/siteBuilder"; import { Card } from "../../../../components/ui/card"; import { Dropdown } from "../../../../components/ui/dropdown/Dropdown"; import { CheckLineIcon } from "../../../../icons"; const labelClass = "text-sm font-semibold text-gray-700 dark:text-white/80 mb-2 inline-block"; const selectClass = "h-11 w-full rounded-xl border border-gray-200 bg-white px-4 text-sm font-medium text-gray-900 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-white/10 dark:bg-white/[0.03] dark:text-white/90 dark:focus:border-brand-800"; const inputClass = "h-11 w-full rounded-xl border border-gray-200 bg-white px-4 text-sm font-medium text-gray-900 placeholder:text-gray-400 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-white/10 dark:bg-white/[0.03] dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800"; const textareaClass = "w-full rounded-2xl border border-gray-200 bg-white px-4 py-3 text-sm font-medium text-gray-900 placeholder:text-gray-400 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-white/10 dark:bg-white/[0.03] dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800"; const palettes = [ "Minimal monochrome with bright accent", "Rich jewel tones with high contrast", "Soft gradients and glassmorphism", "Playful pastel palette", ]; const typography = [ "Modern sans-serif for headings, serif body text", "Editorial serif across the site", "Geometric sans with tight tracking", "Rounded fonts with friendly tone", ]; interface Props { style: StylePreferences; metadata?: SiteBuilderMetadata; brandPersonalityIds: number[]; customBrandPersonality?: string; heroImageryDirectionId: number | null; customHeroImageryDirection?: string; onStyleChange: (partial: Partial) => void; onChange: ( key: K, value: BuilderFormData[K], ) => void; } export function StyleStep({ style, metadata, brandPersonalityIds, customBrandPersonality, heroImageryDirectionId, customHeroImageryDirection, onStyleChange, onChange, }: Props) { const brandOptions = metadata?.brand_personalities ?? []; const heroOptions = metadata?.hero_imagery_directions ?? []; const [heroDropdownOpen, setHeroDropdownOpen] = useState(false); const heroButtonRef = useRef(null); const [brandDropdownOpen, setBrandDropdownOpen] = useState(false); const brandButtonRef = useRef(null); const selectedBrandOptions = useMemo( () => brandOptions.filter((option) => brandPersonalityIds.includes(option.id)), [brandOptions, brandPersonalityIds], ); const selectedHero = heroOptions.find( (option) => option.id === heroImageryDirectionId, ); const toggleBrand = (id: number) => { const isSelected = brandPersonalityIds.includes(id); const next = isSelected ? brandPersonalityIds.filter((value) => value !== id) : [...brandPersonalityIds, id]; onChange("brandPersonalityIds", next); }; return (

Look & feel

Visual direction

Capture the brand personality so the preview canvas mirrors the right tone.

Select up to three descriptors that define the brand tone.

setBrandDropdownOpen(false)} anchorRef={brandButtonRef} placement="bottom-left" className="w-80 max-h-80 overflow-y-auto p-2" > {brandOptions.length === 0 ? (
No brand personalities defined yet. Use the custom field below.
) : ( brandOptions.map((option) => { const isSelected = brandPersonalityIds.includes(option.id); const disabled = !isSelected && brandPersonalityIds.length >= 3; return ( ); }) )}
{selectedBrandOptions.map((option) => ( {option.name} ))} {customBrandPersonality?.trim() && ( {customBrandPersonality.trim()} )}
onChange("customBrandPersonality", event.target.value) } />