Skip to content

refactor: skeleton #6224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: skeleton
  • Loading branch information
aibayanyu20 committed Feb 1, 2023
commit 4061fe2bd854c98662922ba2f10fa68df0883815
8 changes: 6 additions & 2 deletions components/skeleton/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { SkeletonParagraphProps } from './Paragraph';
import Paragraph from './Paragraph';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import Element from './Element';
import useStyle from './style';

/* This only for skeleton internal. */
type SkeletonAvatarProps = Omit<AvatarProps, 'active'>;
Expand Down Expand Up @@ -89,6 +90,8 @@ const Skeleton = defineComponent({
}),
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('skeleton', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

return () => {
const { loading, avatar, title, paragraph, active, round } = props;
const pre = prefixCls.value;
Expand Down Expand Up @@ -152,13 +155,14 @@ const Skeleton = defineComponent({
[`${pre}-active`]: active,
[`${pre}-rtl`]: direction.value === 'rtl',
[`${pre}-round`]: round,
[hashId.value]: true,
});

return (
return wrapSSR(
<div class={cls}>
{avatarNode}
{contentNode}
</div>
</div>,
);
}
return slots.default?.();
Expand Down
Loading