Skip to content

Commit

Permalink
fix: prevent placeholder in runtime for media and tab
Browse files Browse the repository at this point in the history
  • Loading branch information
SH0PK33P3R authored Dec 1, 2020
1 parent 4f11374 commit c71e948
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
17 changes: 10 additions & 7 deletions src/components/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@
}
};

let MediaComponent = () => (
<div className={[(isEmpty || variableDev) && classes.empty]}>
<div className={classes.placeholderWrapper}>
<Placeholder />
{variable && <span>{imgUrl}</span>}
let MediaComponent = () => {
if (!isDev) return null;
return (
<div className={[(isEmpty || variableDev) && classes.empty]}>
<div className={classes.placeholderWrapper}>
<Placeholder />
{variable && <span>{imgUrl}</span>}
</div>
</div>
</div>
);
);
};

if (isImage && !variableDev) {
MediaComponent = () => (
Expand Down
15 changes: 9 additions & 6 deletions src/components/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@

B.defineFunction('Select', doSetTab);

const emptyBox = (
<Box className={classes.empty} p={3}>
Tab
</Box>
);
const EmptyBox = () => {
if (!isDev) return null;
return (
<Box className={classes.empty} p={3}>
Tab
</Box>
);
};

const TabPanel = (isActive || !isDev) && (
<Typography
Expand All @@ -37,7 +40,7 @@
hidden={!isActive}
aria-labelledby="tabs"
>
{children.length === 0 ? emptyBox : children}
{children.length === 0 ? <EmptyBox /> : children}
</Typography>
);

Expand Down

0 comments on commit c71e948

Please sign in to comment.