Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Base Apparel Coming Soon page with Grid

Kevin H. 150

@kevinx9000

Desktop design screenshot for the Base Apparel coming soon page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I got this as far as I could take it, but then had to stop before I went mad. Here's where I need help and guidance:

  • Layout: the sneaky part from the design examples is how the layout changed from desktop to mobile. Since the location of the hero image changes in the flow, I went with grid-template-areas but didn't work out perfectly. For some reason it also left white space on the right of my mobile view that I couldn't get rid of.
  • Submit button: Trying to position it inside the input field. I used positioning, but when the resposive layout changes, sometimes it would be off by a few pixels and no longer fit neatly into the input bar.
  • Background image: Couldn't seem to control it the way I wanted to and match the example. The example seems more transparent and covers more of the page. I tried cover obviously, but that made it too huge so you couldn't see the whole design. This is probably impacted by my choice of Grid layout as mentioned above.
  • Workflow: I started with mobile-first, then tried to convert it to desktop, but it was a nightmare getting the content layout correct. So then I re-did my existing code to adjust for desktop-first and then go to mobile, since desktop was more complex. That almost worked better, except for the extra white space at the right edge of my mobile view that I could not get rid of.

And probably a few more things, but those are the major issues I experienced, so I welcome any and all comments. I plan to come back and rework this again sometime, but I wanted to submit it now as my best effort at the moment, until I can learn how to improve it.

Community feedback

@kabir-afk

Posted

Hey kevin , good job on completing the challenge , on reviewing your queries I was able to work on some of them . . . here are the necessary corrections to be made :-

  • Reason for whitespace
    • so when you inspect your image-on-1024px vw you'll see that your img is centered inside the <picture> element , this is ok but it is also the reason why you see whitespace despite compartmentalizing your grid through grid-template-areas . . . to solve this issue you can do the following:-
picture img{
margin:auto;
width:100%
}

Literally this single addition of line solves your problem and fixes your layout issues

  • Submit btn

    • Not that your approach is wrong but another alternative would have been to use flex on your form element and position it accordingly , this would have been more responsive ig
  • Background-image

    • Well can't really help with that 😅😅. . .but you can try setting your background-size to a custom value like 70vw or whatever suits you, won't be perfect but still better than cover ig
  • Other Issues

    • you forgot to add alt description in your images , not a big deal but quite a need when there is a problem fetching the image properly.
    • you forgot adding id to your input element which is bad in terms of accessibility , it literally presents itself as an issue in your console . . .now here you have a single input element , but once you start working with a lot of inputs inside a single page , it will become a big issue.
  • Regarding JS

Thanks to you I got to know about the checkValidity() method, otherwise up until now I was using JS Regex and using .test method to validate my input values . . .there are still some issues that I would like to address . . . .

Your code really seemed repetitive , especially the constant addition and removal of classes, like you could have used toggle for a shorter and better approach . . . and since you used innerHTML to change the text inside error-message you could have done styling inside it using

errorMessage.innerHTML = !inputField.checkValidity() ?
`<small style="color: red;">Please provide a valid email address</small>`
    : `<small style="color: green;"><b>Success!</b> And immediately shredded.</small>`;

    inputField.style.borderColor = (!inputField.checkValidity()) ? "red" : "green";
    errorIcon.classList.toggle("hidden", inputField.checkValidity());
});
inputField.value = "";

This also avoids need of adding unnecessary classes inside your CSS. Make sure to add the required attribute in your html as well , for the checkValidity() method to work when inputField is empty, something like

<input type="email" placeholder="Email Address" class="input-field" required>

Look , the JS code I provided might not resonate with you very well, but I think its better to write a short , concise and maintainable code when you can . . .

Hope I was able to help, happy coding!! 🥂🥂

Marked as helpful

0

Kevin H. 150

@kevinx9000

Posted

@kabir-afk -- Thank you for all the helpful comments! I will definitely refer to this when reviewing my code.

0

@kabir-afk

Posted

@kevinx9000 I reupdated the JS code since I noticed that there was some typo . . . glad I was able to help

0

Please log in to post a comment

Log in with GitHub
Discord logo

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