'use client' import type { CTA } from '~/types/common' import { useIsLoggedIn } from 'common' import Link from 'next/link' import React, { Children, type ReactNode } from 'react' import { Button, cn } from 'ui' import SectionContainerWithCn from '../Layouts/SectionContainerWithCn' import ProductIcon from '../ProductIcon' import { isCrossZoneHref } from '@/lib/cross-zone' import { resolveDashboardCtaHref } from '@/lib/dashboard-links' // to do: move types to be global // then solutions.types.ts should extend this interface Props { label?: ReactNode h1: ReactNode subheader?: ReactNode icon?: string title?: string image?: React.ReactNode footer?: React.ReactNode footerPosition?: 'left' | 'bottom' | 'right' ctas?: CTA[] className?: string sectionContainerClassName?: string } const ProductHeader = ({ footerPosition = 'left', ...props }: Props) => { const isLoggedIn = useIsLoggedIn() return (
{(props.icon || props.title) && (
{props.icon && } {props.title && ( {props.title} )}
)}

{props.h1}

{props.subheader && (
{Children.map(props.subheader, (subheader, i) => { return (

{subheader}

) })}
)}
{props.ctas?.map((cta) => { const href = resolveDashboardCtaHref(cta.href, isLoggedIn) return ( ) })}
{props.footer && footerPosition === 'left' && (
{props.footer}
)}
{props.image && (
{props.image}
)} {props.footer && footerPosition !== 'left' && (
{props.footer}
)}
) } export default ProductHeader