Last active
August 30, 2021 09:22
-
-
Save drecali/405d1acded0d3ea7dea2abe7783a1a0e to your computer and use it in GitHub Desktop.
This helps visualize differences between the final design and the website/app you're working on. It's faster and requires less code than setting up a visual diff tool. It eliminates the need to constantly switch to the design file to check dimensions and other parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check first comment for instructions and assumptions. | |
import design from "img/design.png"; | |
const Homepage = () => { | |
return ( | |
<> | |
<otherHomepageComponents /> | |
<img | |
src={design} | |
alt="design image that should be removed after Design QA" | |
style={{ | |
zIndex: 99999999999999, // This is probably excessive, but at least it's over 9000! | |
position: "absolute", | |
// match design image dimensions and make sure the browser viewport is the same | |
width: 1370, | |
height: 768, | |
opacity: 0.2, | |
pointerEvents: "none", // Pass mouse events (hover, click, etc) through this image to elements under it | |
border: "1px solid red", // This is only to help you confirm the image is aligned well. Comment/delete this as soon as you can so the border doesn't affect the layout. | |
filter: "invert(100%)", // This makes the differences between the design and the current page more obvious | |
}} | |
></img> | |
</> | |
); | |
}; |
It's my old-days-favorite solution π I'm not using this solution anymore, cause:
- Hard to handle responsive design
- Shows the designers' mistakes that developers can fix(like 1px mis-position)
- Should export the design image by hands.
But I don't think this solution is bad idea. Especially, 2 and 3 could be solved with some kind of automation tools(Figma plugin? Chrome extension?)
@deminoth
Good point, it's not a perfect solution, but it seemed better to me than manually checking the spacing for each element in Figma. Is there a more elegant solution that can also be implemented relatively quickly?
The ideal seems to be using a visual testing tool that integrates with Figma but that requires more time and management of the limits for free/paid plans.
@deminoth
Wow, thanks! That's much more obvious! π
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I usually do this with the entire viewport, so here is an example with the following assumptions:
Instructions