/* eslint-disable react-hooks/globals -- TODO: fix then remove this comment */ import React from 'react' import styles from './_graph-loading.module.scss' // Default to go off of const smallSize = 130 const largeSize = 250 let mainHeight let fakeLineSpread let sectionHeight interface GraphLoadingProps { /** * Predefined size for the loading animation. * - 'small': 130px base height with compact proportions * - 'large': 250px base height with expanded proportions (default) */ size?: 'small' | 'large' /** * Custom height in pixels for the entire loading container. * When provided, overrides the size prop and calculates proportions automatically. */ height?: number /** * Custom height in pixels specifically for the animated line elements. * Allows fine-tuning of the graph line area independent of overall height. */ lineCustomHeight?: number /** * Optional test identifier for QA testing and automation. * Applied as 'qa-test-id' attribute to the root container. */ qaTestId?: string } const GraphLoading = ({ size = 'large', height, lineCustomHeight = 0, qaTestId = 'graph-loading', }: GraphLoadingProps): React.JSX.Element => { if (height) { mainHeight = height - 40 fakeLineSpread = height - 60 sectionHeight = height - 100 } else { const baseSize = size === 'small' ? smallSize : largeSize mainHeight = baseSize + 30 fakeLineSpread = baseSize sectionHeight = baseSize - 80 } return (
{size === 'small' || (height && height <= 130) ? ( ) : ( )}
) } export default GraphLoading