import classNames from 'classnames'; import React, { FC, ReactType, Fragment } from 'react'; import { LinkProps } from '../../blocks/Link'; import Content from '../Content'; import css from './index.module.css'; import { ImageProps } from '../../blocks/Image'; import { MilaGridVoid, MilaGridColumn, MilaGridContainer } from '../../index'; import { PartnerListProps } from '../PartnerList'; export interface BannerProps { Image?: ReactType; ImageProps?: { fixed?: unknown; imgStyle?: unknown; style?: unknown; svg?: { title?: string; description?: string; svg?: { absolutePath?: string; content?: string; dataURI?: string; originalContent?: string; relativePath?: string; }; file?: { contentType?: string; url?: string; fileName?: string; details?: { image?: { width?: string; height?: string; }; }; }; fluid?: unknown; }; }; isSvgImage?: boolean; title?: string; subtitle?: string; pageType?: string; cta?: LinkProps; LogoProps?: ImageProps; Logo?: ReactType; Link?: ReactType; CategoryTab?: ReactType; FeaturedPartnersList?: ReactType; FeaturedPartnersListProps?: PartnerListProps; bannerBackgroundColor?: string; isPackage?: boolean; } const Banner: FC = ({ Image, ImageProps, isSvgImage = false, title, subtitle, pageType, cta, LogoProps, Logo, Link, CategoryTab, FeaturedPartnersList, FeaturedPartnersListProps, bannerBackgroundColor, isPackage = false, }) => { const bannerClassNames = classNames(css.banner, { [css.bannerPackage]: isPackage, [css.bannerWithImage]: !!ImageProps && isPackage, [css.bannerWithLogo]: !!LogoProps, [css.bannerWithSvgImage]: !!ImageProps?.svg?.svg, [css.bannerWithFeaturedPartner]: !!FeaturedPartnersListProps, }); const bannerTitles = classNames({ [css.banner__titles]: true, }); const bannerContainer = classNames({ [css.banner__text]: pageType !== 'partner', [css.banner__container]: pageType === 'partner', }); const isSvgLogo = LogoProps && LogoProps?.file?.contentType === 'image/svg+xml'; return (
{!isSvgImage && !!Image && } {LogoProps && Logo && (
{!isSvgLogo && ( )} {isSvgLogo && (
)}
)} {!!Image && !!ImageProps && ( {isSvgImage && ImageProps?.svg?.svg && (
)} )} {(title || subtitle) && (
{title && (

{title === 'axaReplace' ? '' : title}

{subtitle && (

{subtitle}

)} {cta && (

)}
)}
)} {CategoryTab} {FeaturedPartnersList && FeaturedPartnersListProps && ( )}
); }; export default Banner;