import cn from 'classnames';
import { TruncateString } from '@snack-uikit/truncate-string';
import { Typography } from '@snack-uikit/typography';
import { excludeSupportProps, WithSupportProps } from '@snack-uikit/utils';
import { TEST_IDS } from '../../constants';
import { useCardContext } from '../../context';
import { Emblem, EmblemProps } from '../../helperComponents';
import { Size } from '../../types';
import { DESCRIPTION_SIZE_MAP, TITLE_SIZE_MAP, TRUNCATE_DEFAULTS } from './constants';
import styles from './styles.module.scss';
export type HeaderProps = WithSupportProps<{
/** Заголовок */
title: string;
/** Подзаголовок */
description?: string;
/** Метаинформация */
metadata?: string;
/**
* Максимальное кол-во строк
*
- `title` - в заголовке
*
- `description` - в описании
*
- `metadata` - в подзаголовке
* @default '{
title: 1;
description: 2;
metadata: 1; }'
*/
truncate?: {
title?: number;
description?: number;
metadata?: number;
};
/** Эмблема иконка/картинка */
emblem?: EmblemProps;
/** CSS-класс для элемента с контентом */
className?: string;
/** Размер */
size?: Size;
}>;
export function Header({
title,
description,
metadata,
truncate,
emblem,
className,
size: sizeProp,
...rest
}: HeaderProps) {
const { size: sizeContext } = useCardContext();
const size = sizeProp || sizeContext;
const truncateStrings = { ...TRUNCATE_DEFAULTS, ...truncate };
return (