import { Form, FormTextProps as BS5FormTextProps } from 'react-bootstrap' import MaterialIcon from '@/shared/components/material-icon' import classnames from 'classnames' import { MergeAndOverride } from '../../../../../types/utils' type TextType = 'default' | 'info' | 'success' | 'warning' | 'error' export type FormTextProps = MergeAndOverride< BS5FormTextProps, { type?: TextType unfilled?: boolean marginless?: boolean } > const typeClassMap: Partial> = { error: 'text-danger', success: 'text-success', warning: 'text-warning', } export const getFormTextClass = (type?: TextType) => typeClassMap[type || 'default'] function FormTextIcon({ type, unfilled, }: Pick) { switch (type) { case 'info': return unfilled ? ( ) : ( ) case 'success': return unfilled ? ( ) : ( ) case 'warning': return unfilled ? ( ) : ( ) case 'error': return unfilled ? ( ) : ( ) default: return null } } function FormText({ type = 'default', marginless, children, className, unfilled, ...rest }: FormTextProps) { return ( {children} ) } export default FormText