import React from 'react'; import { hexToRgba } from '../../utils'; import type { EditTags } from '../../types'; export interface SectionIntroductionTwoColumnColorValue { hex?: string; } /** `left` / `right` group: one column's body copy and optional background image. */ export interface SectionIntroductionTwoColumnColumn { description?: string; background_image?: string; $?: EditTags; } export interface SectionIntroductionTwoColumnProps { className?: string; step_number?: string; eyebrow_text?: string; heading?: string; left?: SectionIntroductionTwoColumnColumn; right?: SectionIntroductionTwoColumnColumn; /** @deprecated moved to left.description — kept so older entries still render */ left_description?: string; /** @deprecated moved to right.description — kept so older entries still render */ right_description?: string; /** @deprecated moved to left.background_image — kept so older entries still render */ left_background_image?: string; /** @deprecated moved to right.background_image — kept so older entries still render */ right_background_image?: string; background_color?: SectionIntroductionTwoColumnColorValue; text_color?: SectionIntroductionTwoColumnColorValue; /** Contentstack Live Preview edit tags for this entry's own fields. See `EditTags`. */ $?: EditTags; } /** Default column groups; the deprecated loose props carry no defaults of their own. */ const DEFAULT_LEFT: SectionIntroductionTwoColumnColumn = { description: 'We love being an integral part of the creative process, and rising to the challenge of making complex software approachable to the masses. With all of our work, we hope to empower users and simplify their everyday lives.', }; const DEFAULT_RIGHT: SectionIntroductionTwoColumnColumn = { description: '

We believe that forward-thinking design can be a driving force behind technological progress. In the various projects we were a part of, our team have worked to advance user experience.

The only constant in this world is change, and that\'s especially evident in the way we design and the way we build.

', }; export function SectionIntroductionTwoColumn({ className, step_number = '01 /', eyebrow_text: eyebrowText = 'About', heading = 'We believe in forward-thinking design', left, right, left_description, right_description, left_background_image, right_background_image, background_color: backgroundColor, text_color: textColor = { hex: '#111827' }, $, }: SectionIntroductionTwoColumnProps) { // Grouped value first, then the deprecated loose prop, then the default. const leftDescription = left?.description ?? left_description ?? DEFAULT_LEFT.description; const rightDescription = right?.description ?? right_description ?? DEFAULT_RIGHT.description; const leftBgImage = left?.background_image ?? left_background_image ?? DEFAULT_LEFT.background_image; const rightBgImage = right?.background_image ?? right_background_image ?? DEFAULT_RIGHT.background_image; const textHex = textColor?.hex ?? '#111827'; const sectionBg = backgroundColor?.hex ?? '#ffffff'; // When a column has a bg image, text switches to white for readability const leftTextHex = leftBgImage ? '#ffffff' : textHex; const rightTextHex = rightBgImage ? '#ffffff' : textHex; const colBase = 'relative flex flex-col overflow-hidden rounded-xl'; const bgImageStyle = (url?: string): React.CSSProperties => url ? { backgroundImage: `url(${url})`, backgroundSize: 'cover', backgroundPosition: 'center', } : {}; return (
{/* ── Left column ──────────────────────────────────────────── */}
{/* Dark overlay when image is present */} {leftBgImage && (
)}
{/* Step number */} {step_number && ( {step_number} )} {/* Left body text */} {leftDescription && (
)}
{/* ── Right column ─────────────────────────────────────────── */}
{/* Dark overlay when image is present */} {rightBgImage && (
)}
{/* Eyebrow */} {eyebrowText && ( {eyebrowText} )} {/* Heading */} {heading && (

{heading}

)} {/* Divider — hidden when image bg is set to keep it clean */} {!rightBgImage && (
)} {/* Right body text */} {rightDescription && (
)}
); } export default SectionIntroductionTwoColumn;