Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 3x 3x 3x 3x | import React from "react";
import classNames from "classnames";
import { Icon } from "../icon";
import { useTranslation } from "../i18n";
import { StyledProps } from "../_type";
import { useConfig } from "../_util/config-context";
export interface LoadingTipProps extends StyledProps {
/**
* 加载文案
* @default "加载中..."
*/
loadingText?: React.ReactNode;
/**
* 隐藏图标
* @default false
*/
hideIcon?: boolean;
}
export function LoadingTip(props: LoadingTipProps) {
const { classPrefix } = useConfig();
const t = useTranslation();
const { hideIcon, className, style, loadingText = t.loadingText } = props;
return (
<span
className={classNames(`${classPrefix}-action-state`, className)}
style={style}
>
{!hideIcon && <Icon type="loading" className={`${classPrefix}-mr-2n`} />}
{typeof loadingText === "string" ? (
<span className={`${classPrefix}-action-state__text`}>
{loadingText}
</span>
) : (
loadingText
)}
</span>
);
}
|