import React, { forwardRef } from 'react'; import classnames from 'classnames'; import { TextVariant, TextColor, } from '../../../helpers/constants/design-system'; import { Text } from '../text'; import type { PolymorphicRef } from '../box'; import type { TextProps } from '../text'; import type { HelpTextProps, HelpTextComponent } from './help-text.types'; import { HelpTextSeverity } from '.'; export const HelpText: HelpTextComponent = forwardRef( ( { severity, color = TextColor.textDefault, className, children, ...props }: HelpTextProps, ref?: PolymorphicRef, ) => { const severityColor = () => { switch (severity) { case HelpTextSeverity.Danger: return TextColor.errorDefault; case HelpTextSeverity.Warning: return TextColor.warningDefault; case HelpTextSeverity.Success: return TextColor.successDefault; case HelpTextSeverity.Info: return TextColor.infoDefault; // Defaults to HelpTextSeverity.Info default: return TextColor.textDefault; } }; return ( )} > {children} ); }, );