mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
c4b8c9df93
* refactor: genStyleHooks * chore: update sciprt * refactor: affix * refactor: select * chore: update * refactor: update * refactor: update * refactor: done * chore: code clean * chore: code clean * chore: fix lint * chore: decrease size limit * chore: code clean * chore: code clean * chore: remove export
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import classNames from 'classnames';
|
|
import omit from 'rc-util/lib/omit';
|
|
import * as React from 'react';
|
|
import { ConfigContext } from '../config-provider';
|
|
import type { SkeletonElementProps } from './Element';
|
|
import Element from './Element';
|
|
|
|
import useStyle from './style';
|
|
|
|
export interface SkeletonInputProps extends Omit<SkeletonElementProps, 'size' | 'shape'> {
|
|
size?: 'large' | 'small' | 'default';
|
|
block?: boolean;
|
|
}
|
|
|
|
const SkeletonInput: React.FC<SkeletonInputProps> = (props) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
className,
|
|
rootClassName,
|
|
active,
|
|
block,
|
|
size = 'default',
|
|
} = props;
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
|
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
|
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
|
|
|
const otherProps = omit(props, ['prefixCls']);
|
|
const cls = classNames(
|
|
prefixCls,
|
|
`${prefixCls}-element`,
|
|
{
|
|
[`${prefixCls}-active`]: active,
|
|
[`${prefixCls}-block`]: block,
|
|
},
|
|
className,
|
|
rootClassName,
|
|
hashId,
|
|
);
|
|
|
|
return wrapCSSVar(
|
|
<div className={cls}>
|
|
<Element prefixCls={`${prefixCls}-input`} size={size} {...otherProps} />
|
|
</div>,
|
|
);
|
|
};
|
|
|
|
export default SkeletonInput;
|