Skip to content

Commit

Permalink
fix skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreCrb committed Sep 15, 2022
1 parent 0d2e816 commit c0b7ef8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
16 changes: 6 additions & 10 deletions src/components/editor/previews/SkeletonPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ const SkeletonPreview: React.FC<{ component: IComponent }> = ({
component,
}) => {
const { drop, isOver } = useDropComponent(component.id)
const { props, ref } = useInteractive(component, true)

let boxProps: any = {}
const { props, ref } = useInteractive(component, true, true)

if (isOver) {
props.bg = 'teal.50'
}

return (
<Box ref={drop(ref)} {...boxProps}>
<Skeleton {...props}>
<Box ref={drop(ref)} {...props} m={0}>
<Skeleton {...component.props}>
{component.children.map((key: string) => (
<ComponentPreview key={key} componentName={key} />
))}
Expand Down Expand Up @@ -49,18 +47,16 @@ export const SkeletonTextPreview = ({ component }: IPreviewProps) => {
}

export const SkeletonCirclePreview = ({ component }: IPreviewProps) => {
const { props, ref } = useInteractive(component, true)
const { props, ref } = useInteractive(component, true, true)
const { drop, isOver } = useDropComponent(component.id)

let boxProps: any = {}

if (isOver) {
props.bg = 'teal.50'
}

return (
<Box ref={drop(ref)} {...boxProps}>
<SkeletonCircle {...props}>
<Box display="inline-block" ref={drop(ref)} {...props}>
<SkeletonCircle {...component.props}>
{component.children.map((key: string) => (
<ComponentPreview key={key} componentName={key} />
))}
Expand Down
23 changes: 20 additions & 3 deletions src/utils/defaultProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,26 @@ export const DEFAULT_PROPS: PreviewDefaultProps = {
alignItems: 'center',
},
StatGroup: {},
Skeleton: {},
SkeletonCircle: {},
SkeletonText: {},
Skeleton: {
height: 50,

form: {
fadeDuration: 0.4,
speed: 0.8,
},
},
SkeletonCircle: {
form: {
fadeDuration: 0.4,
speed: 0.8,
},
},
SkeletonText: {
form: {
fadeDuration: 0.4,
speed: 0.8,
},
},
Switch: {
isChecked: false,
},
Expand Down

0 comments on commit c0b7ef8

Please sign in to comment.