import React from 'react'; import { rdsFontSizes, rdsMaxWidth } from '../../utils/tailwindClasses'; import { BannerAnimated } from './Banner.Animated'; export interface BannerProps { children?: React.ReactNode; title?: string; paragraph?: string; fontSize?: '5xl' | '6xl'; maxWidth?: 'none' | 'full' | '5xl' | '7xl'; isType?: | 'light-grey' | 'light-fade' | 'dark-wave' | 'red-wave' | 'image' | 'animated'; align?: 'center' | 'left'; hasOverlap?: boolean; image?: string; imageAlt?: string; } export interface BannerImgProps { image?: string; imageAlt?: string; } const styles = { core: `not-prose relative py-16 md:py-32 md:flex md:items-center md:px-8 md:min-h-[240px]`, buttonWrapper: `flex gap-6 flex-wrap md:flex-1`, overlap: `md:pb-32 md:pt-20`, }; const typeStyles = { 'light-grey': `bg-cu-black-50 text-cu-black-800`, 'light-fade': `bg-gradient-to-b from-white to-cu-black-50 text-cu-black-800`, 'dark-wave': `bg-cu-black-800 text-white`, 'red-wave': `bg-gradient-to-b from-cu-red to-cu-red-900 text-white`, animated: `bg-white text-cu-black-800`, image: `bg-cu-black-800 text-white md:py-48`, }; const contentStyles = { title: `font-semibold text-3xl`, paragraph: `text-base lg:text-xl max-w-5xl`, }; const BannerBase = ({ children, title, paragraph, maxWidth = '5xl', isType = 'light-grey', fontSize = '5xl', align = 'center', hasOverlap, image, imageAlt = 'Decorative background image', }: BannerProps & BannerImgProps) => { const bannerSpacing = isType === 'image' ? 'md:py-48' : 'md:py-32'; const flexAlign = align === 'center' ? 'flex-col last:[&>*]:justify-center' : 'flex-col md:flex-row last:[&>*]:justify-center last:md:[&>*]:justify-end'; const hasParaAndButtons = paragraph && children ? ' md:max-w-3xl md:w-8/12' : ''; const contentAlign = align === 'center' ? 'text-center' : 'text-center md:text-left' + hasParaAndButtons; let overlapStyles = hasOverlap ? styles.overlap : ''; if (hasOverlap && isType === 'image') { overlapStyles = 'md:pb-48 md:pt-40'; } // const overlapStyles2 = // hasOverlap && isType !== image ? styles.overlap : 'md:pb-48'; // alert(overlapStyles); return ( <> ); }; const BannerImg = ({ image, imageAlt }: BannerImgProps) => { return (
{imageAlt} ); }; const BannerWave = () => { return (
); }; const ButtonGroup = ({ children }: BannerProps) => { return
{children}
; }; export const Banner = Object.assign(BannerBase, { ButtonGroup, }); BannerBase.displayName = 'Banner'; ButtonGroup.displayName = 'Banner.ButtonGroup';