Skip to content

Commit

Permalink
[EmptyState] Manually set height
Browse files Browse the repository at this point in the history
  • Loading branch information
laurkim committed Mar 29, 2024
1 parent 2d121d1 commit f5bac0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 4 additions & 0 deletions polaris-react/src/components/EmptyState/EmptyState.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.Image {
height: 226px;
}

.imageContained {
@media (--p-breakpoints-md-up) {
position: initial;
Expand Down
13 changes: 1 addition & 12 deletions polaris-react/src/components/EmptyState/EmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,8 @@ export function EmptyState({
secondaryAction,
footerContent,
}: EmptyStateProps) {
const [imageLoaded, setImageLoaded] = useState<boolean>(false);

useEffect(() => {
const img: HTMLImageElement = new window.Image(0, 0);
img.src = largeImage || image;
img.onload = () => {
setImageLoaded(true);
};
}, [largeImage, image]);

if (!imageLoaded) return null;

const imageContainedClass = classNames(
styles.Image,
imageContained && styles.imageContained,
);

Expand Down

0 comments on commit f5bac0a

Please sign in to comment.