UNPKG

@i-novus/ui-core

Version:

Базовые UI компоненты

19 lines (18 loc) 792 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef, useMemo } from 'react'; import classNames from 'classnames'; import { useConfigProvider } from '../../core'; import { TypographyBody } from './Typography'; const typographyLevel = [1, 2, 3, 4, 5, 6]; export const Title = forwardRef((props, ref) => { const { level, className, prefix, ...restProps } = props; const { getPrefix } = useConfigProvider(); const prefixCls = getPrefix(prefix); const tag = useMemo(() => { if (!level || !typographyLevel.includes(Number(level))) { return 'h1'; } return `h${level}`; }, [level]); return (_jsx(TypographyBody, { tag: tag, ref: ref, className: classNames(className, `${prefixCls}-typography-title`), ...restProps })); });