Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Time Tracking Dashboard using CSS FlexBox and Grid

P
Achara Chisom Solomon•710
@AcharaChisomSolomon
A solution to the Time tracking dashboard challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

proud of how I utilized the 'data-' attribute

in CSS =>

#main .daily,
#main .weekly,
#main .monthly {
    display: none;
}
#main[data-theme='daily'] .daily,
#main[data-theme='weekly'] .weekly,
#main[data-theme='monthly'] .monthly{
    display: flex;
}

in javascript =>

function changeToTheme(btn) {
    const btns = [dayBtn, weekBtn, monthBtn];

    for (const btn of btns) { 
        btn.classList.remove('active');
    }

    btn.classList.add('active');
    main.dataset.theme = btn.id;
}

dayBtn.addEventListener('click', () => { 
    changeToTheme(dayBtn);
});

weekBtn.addEventListener('click', () => { 
    changeToTheme(weekBtn);
});

monthBtn.addEventListener('click', () => {
    changeToTheme(monthBtn);
 });

in HTML

               
                    ${item.timeframes.weekly.current}hrs
                    Last Week - ${item.timeframes.weekly.previous}hrs
                
                
                    ${item.timeframes.daily.current}hrs
                    Yesterday - ${item.timeframes.daily.previous}hrs
                
                
                    ${item.timeframes.monthly.current}hrs
                    Last Month - ${item.timeframes.monthly.previous}hrs
                
What challenges did you encounter, and how did you overcome them?

working with the 'data-' attributes was a little confusing, loads of googling helped

What specific areas of your project would you like help with?

None for now. But any feedback is welcome, Thanks!!!!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Achara Chisom Solomon'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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License