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

Officelite using JS, CSS Grid/flexbox, SASS

Huynh Nguyenβ€’ 430

@Nghuynh07

Desktop design screenshot for the Officelite coming soon site coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please advise on the timer. At its current state, when the user refreshes the page the timer will restart from the beginning. I want the timer to continue where it left off even when the user refreshes the page or closes the browser. I tried persisting it using localStorage but wasn't successful: localStorage.setItem(). I tried setting it individually and as an object, but was unsuccessful.

Thank you for all the feedbacks

Community feedback

Vanza Setiaβ€’ 27,855

@vanzasetia

Posted

Hey, Huynh Nguyen! πŸ‘‹

Congratulations on completing this challenge! πŸŽ‰

For the timer, I recommend setting the coming soon date by adding more days instead of milliseconds. So, the way it works is to

  • Get today's date
  • Then, create the coming soon date based on today's date + 30 days.
/* app.js | https://github.com/vanzasetia/officelite-coming-soon-site/blob/main/js/app.js */

const getThirtyDaysDateFromToday = () => {
  const TODAY = new Date();
  const THIRTY_DAYS_FROM_TODAY = new Date(
    TODAY.getFullYear(),
    TODAY.getMonth(),
    TODAY.getDate() + 30
  );
  return THIRTY_DAYS_FROM_TODAY;
};

const comingSoonDate = getThirtyDaysDateFromToday();

Also, there's no need for localStorage. You may want to use it if you want to the users to have the same coming soon when they come back to the site tomorrow (or any time in the future).

Here are some suggestions for improvements.

  • For the custom select element, I recommend creating it with accessibility in mind. I recommend following the "Select-Only Combobox Example | APG | WAI | W3C".
  • For the logo, the alternative text should not contain the word "logo". It should be the name of the company ("officelite"). Also, since it is wrapped by a link, the alternative text should tell the users that it is also a link ("officelite - home").
  • Heading levels must always be in order to give structure to a page. I recommend reading the "How-to: Accessible heading structure - The A11Y Project" article to learn how to use headings correctly.
  • Those timer__numbers are not headings. They should be a paragraph. I would wrap the entire countdown component in one paragraph. Then, wrapped each text with a span instead.
  • Avoid using JavaScript to add styling (unless you have no other option). JavaScript allows you to change the CSS code using the style property. But, to make debugging easier and improve code maintainability, it’s best to avoid it. Use CSS classes instead.

I hope this helps! Happy coding! πŸ˜„

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