1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Typography.tsx 1.7 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
xilang Отправлено 3 лет назад a281450
import React, { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
import classNames from 'classnames';
import { composeRef } from 'rc-util/lib/ref';
import warning from 'choerodon-ui/lib/_util/warning';
import ConfigContext from 'choerodon-ui/lib/config-provider/ConfigContext';
export interface TypographyProps {
id?: string;
prefixCls?: string;
suffixCls?: string;
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
component?: string;
setContentRef?: (node: HTMLElement) => void;
['aria-label']?: string;
}
export interface ITypographyProps extends ForwardRefExoticComponent<PropsWithoutRef<TypographyProps> & RefAttributes<HTMLElement>> {
__PRO_TYPOGRAPHY?: boolean;
}
const Typography: ITypographyProps = React.forwardRef<HTMLElement, TypographyProps>((props, ref) => {
const {
prefixCls: customizePrefixCls,
component,
className,
'aria-label': ariaLabel,
setContentRef,
children,
...restProps
} = props;
const { getProPrefixCls } = React.useContext(ConfigContext);
let mergedRef = ref;
if (setContentRef) {
warning(false, `[c7n: Typography] setContentRef is deprecated. Please use ref instead.`);
mergedRef = composeRef(ref, setContentRef);
}
const Component = component as any;
const prefixCls = getProPrefixCls('typography', customizePrefixCls);
const componentClassName = classNames(
prefixCls,
className,
);
return (
<Component className={componentClassName} aria-label={ariaLabel} ref={mergedRef} {...restProps}>
{children}
</Component>
);
});
Typography.__PRO_TYPOGRAPHY = true;
Typography.displayName = 'Typography';
Typography.defaultProps = {
component: 'article',
};
export default Typography;

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
master