import type { HTMLAttributes, ReactNode } from 'react' import React, { forwardRef } from 'react' import { Icon, LinkButton } from '../..' import { useHero } from './Hero' export interface HeroHeaderProps extends HTMLAttributes { /** * Content for the h1 tag. */ title: string /** * Content for the p tag. */ subtitle: string /** * Icon component for additional customization. */ icon?: ReactNode /** * Specifies the URL the action button goes to. */ link?: string /** * Specifies the action button's content. */ linkText?: string /** * ID to find this component in testing tools (e.g.: cypress, testing library, and jest). */ testId?: string /** * Specify if the link opens in a new tab. */ linkTargetBlank?: boolean } const HeroHeader = forwardRef( function HeroHeader( { icon, link, title, linkText, linkTargetBlank, subtitle, children, testId = 'fs-hero-heading', ...otherProps }, ref ) { const { variant, colorVariant } = useHero() return ( {title} {subtitle} {!!link && ( } iconPosition="right" target={linkTargetBlank ? '_blank' : undefined} > {linkText} )} {!!icon && variant === 'secondary' && ( {icon} )} ) } ) export default HeroHeader
{subtitle}