Page MenuHomePhabricator

[web] Introduce `BackgroundIllustration` component to replace S3-hosted asset
ClosedPublic

Authored by atul on Aug 9 2022, 11:46 AM.
Tags
None
Referenced Files
F2175079: D4785.id15489.diff
Wed, Jul 3, 1:54 AM
F2174896: D4785.id15511.diff
Wed, Jul 3, 1:26 AM
F2167406: D4785.id15489.diff
Tue, Jul 2, 6:16 AM
Unknown Object (File)
Mon, Jul 1, 2:53 AM
Unknown Object (File)
Sun, Jun 30, 6:23 PM
Unknown Object (File)
Thu, Jun 27, 12:40 AM
Unknown Object (File)
Fri, Jun 14, 7:03 AM
Unknown Object (File)
Fri, Jun 14, 12:53 AM
Subscribers

Details

Summary

Context: https://linear.app/comm/issue/ENG-1584/[web]-replace-s3-svg-urls-with-svgr-generated-react-components

We previously were fetching background-illustration.svg from S3. It took a second for the SVG to download, which led to the page reflowing. We got around the reflowing issue by explicitly stating the height/width of every SVG asset so there was some "placeholder space" left for the asset to fill once it loaded. This led to an expensive process when adding SVG assets to web.

Instead, we can convert the SVG into a React component using SVGR (https://react-svgr.com/playground/) and include it in the repo. This also lets us avoid fetching the asset once the app has loaded.

Test Plan

Things continue to look as expected.

Before:

Screen Shot 2022-08-09 at 2.37.28 PM.png (670×818 px, 65 KB)

After:

Screen Shot 2022-08-09 at 2.38.11 PM.png (670×818 px, 65 KB)

Before (Inspect element):

Screen Shot 2022-08-09 at 2.39.11 PM.png (84×1 px, 56 KB)

After (Inspect element):

Screen Shot 2022-08-09 at 2.38.29 PM.png (292×2 px, 174 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable