Submitted over 1 year agoA solution to the QR code component challenge
QR Code Component
react, styled-components, vite
@alkersan

Solution retrospective
What challenges did you encounter, and how did you overcome them?
It was tricky to figure out how to prevent vertical and horizontal content loss on smaller viewports, e.g. less than 320px (see the screen recording). Here's the snippet that worked for me (and resulting recording):
const Main = styled.main`
...
min-width: fit-content;
min-height: 100%;
display: flex;
justify-content: center;
align-items: center;
`;
const CardWrapper = styled.div`
// Don't grow horizontally more than minimally possible to contain the card
// I guess it works because nested image has fixed dimensions
max-width: min-content;
...
img {
display: block;
width: 288px;
height: 288px;
}
`;
Code
Loading...
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Dmytro's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord