Responsive web app using CSS Grid, Flexbox and JavaScript

Solution retrospective
This has been a fun and challenging project. It's the first time I've used Parcel and new Dart Sass. I'm not an expert in Sass but I'm keen to learn more about using "@use" & "@forward" syntax - so any feedback would be appreciated. Also, if anyone could point me to a good, preferably written, tutorial on a workflow using Parcel, I'd really appreciate that too as I feel in this project I've guessed my way through a lot of Parcel-related stuff. Thanks guys!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @A-amon
Hello! I gotta say, your code is neat and clean π
Here are some suggestions you might find helpful:
- The .daily, .weekly, .monthly
li
elements should be/have an interactive element. π± They can bebutton
ora
. In my solution, I usedbutton
and gave them therole="tab"
. π You can check out accessible tabs if you want to use the same approach. π - I believe the images for each .stats aren't that important to be made known to screen readers. Hence, instead of "Icon play", etc. , you can leave it empty
alt=""
. You can read this. π - I noticed most of the lines in your JS are similar. For e.g.
populateMonthly()
,populateWeekly()
andpopulateDaily()
, you can create a functionpopulateStats()
for e.g., to do all three. The difference in these functions lies intimeframes.weekly.current
where the weekly could be replaced with daily or monthly. This can be passed as argument to the newly createdpopulateStats()
. π
function populateStats(timeframe) { let datacounter = 0; cards.forEach(card => { const workHours = card.querySelector('.stats__hrs--num'); const prevWeekHrs = card.querySelector('.stats__prev__hrs'); workHours.textContent = data[datacounter].timeframes[timeframe].current; prevWeekHrs.textContent = data[datacounter].timeframes[timeframe].previous; datacounter++; }); }
The code might or might not work. You'll have to test it out and make changes accordingly. π
- forEach comes with index, so you don't have to manually create a
datacounter
variable to do it. forEach
cards.forEach((card, index) => { ... })
By the way, I finally know what to put into
typography.scss
, thanks to you! π Awesome work~Marked as helpful - The .daily, .weekly, .monthly
- @dmitrymitenkoff
Hey Amon, Thanks very much for your detailed feedback. I refactored the JS function as you suggested - thanks for that as I'd spent ages trying to figure that out!
Cheers:)
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