import React from 'react' import Badge, { type BadgeProps } from '../Badge/Badge' import Icon from '../Icons/Icon' import Tooltip from '../Tooltip/Tooltip' import { type TooltipProps } from '../Tooltip/Tooltip' import styles from './_unsorted-column.module.scss' import { createTwoLineLabel } from '../../services/tableHelperFunctions' import Tag, { type TagProps } from '../Tag/Tag' type UnsortedColumnTooltipProps = { /** Define the tooltip content */ content: TooltipProps['tooltipContent'] /** Position for the tooltip */ position?: TooltipProps['position'] /** Max width for the tooltip */ maxWidth?: TooltipProps['maxWidth'] } type UnsortedColumnProps = { /** Unique label for the unsorted column headers. */ label: string /** Define the tooltip for a column. */ tooltip?: UnsortedColumnTooltipProps /** Class name for a column. */ className?: string /** This prop will provide extra space for the column when the `showStickyClasses` boolean is `true` in our tables. */ extraSpaceWhenStickyColumn?: boolean /** Optional boolean to add beta tag to header */ beta?: boolean /** Optional badge props to render a badge. If provided, badgeProps takes precedence over beta. */ badgeProps?: BadgeProps /** Optional tag props to render a tag. If provided, tagProps takes precedence over badgeProps. */ tagProps?: TagProps /** Optional boolean to split the label into two lines */ twoLineLabel?: boolean } const UnsortedColumn = ({ label, tooltip, className = '', extraSpaceWhenStickyColumn, beta, badgeProps, tagProps, twoLineLabel, }: UnsortedColumnProps): React.JSX.Element => { return ( {createTwoLineLabel(label, twoLineLabel)} {tagProps ? ( ) : badgeProps ? ( ) : beta ? ( ) : null} {tooltip ? ( ) : null} ) } export default UnsortedColumn