import { ReactNode } from 'react'; import { Box, Flex, Heading, IconButton, Text, useDefaultLabel } from 'gestalt'; import { useChartContext } from './ChartGraphContext'; export default function Header({ title, readyToRender, description, onVisualPatternChange, helpButton, titleDisplay, toggleTabularDataModal, showTabularData, }: { readyToRender: boolean; title?: string; description?: string; onVisualPatternChange: () => void; helpButton?: ReactNode; titleDisplay?: 'visible' | 'hidden'; toggleTabularDataModal: () => void; showTabularData: boolean; }) { const { accessibleViewText, defaultViewText, tabularData } = useDefaultLabel('ChartGraph'); const { decal: showVisualPattern } = useChartContext(); return ( {titleDisplay === 'hidden' ? null : ( {title} {helpButton || null} {/* We need this hack to tick the eye while chart is not rendered and title/description is repositioning. This prevents from seeing title/description flick. */} {description} )} {showVisualPattern === 'disabled' ? null : ( )} ); }