From b8026b9a4eae65f36abc183867293f08402a4151 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 16 Aug 2019 07:28:36 -0700 Subject: [PATCH] Use background for showing images This prevents images which are larger than the element from having their image squished. --- modern/src/App.js | 52 +++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/modern/src/App.js b/modern/src/App.js index f540fd53..1fb5ddcc 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -148,22 +148,25 @@ function Layout({ } return ( - <> - +
{children} - +
); } @@ -196,17 +199,18 @@ function Layer({ node, id, image, children, x, y }) { if (img.h !== undefined) { params.height = Number(img.h); } + if (img.imgUrl !== undefined) { + params.backgroundImage = `url(${img.imgUrl}`; + } return ( - <> - +
{children} - +
); }