Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 4 years ago

Time Tracking Dashboard w/ React(react-create-app), json-server & Sass

accessibility, react, sass/scss, bem
Yuko Horita•645
@Sloth247
A solution to the Time tracking dashboard challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi there, thanks for visiting my solution page. This is my 2nd React challenge at FEM, it was tough using React rather than using only HTML and vanilla JavaScript...! I used custom hooks introduced in NetNinja tutorial and used context object. I may have been thinking in a overcomplicated way, so I'd like to know if there's any simpler solutions for this challenge. I have the following issues / questions that came up;

1. Accessibility

  • In FrequencySelector.js file, I have three buttons (Daily, Weekly, and Monthly). I am not sure that I should use "aria-expanded" and "aria-controls" for this situation, as there are no expandable/collapsing elements. The button is kind of switches. I put "aria-expanded" however I could not use "aria-controls" because I was not sure where to put "id". If I have switched entire cards by pressing buttons, I could use aria-controls?
  • I used ternary operator to toggle aria-expanded, but is there better way for this? (e.g. using useState like; const [ariaExpanded, setAriaExpanded] = useState("false"))

This issue has been solved by help with @AlexKMarshall !!

2. React & json-server

  • In TaskList.js, I had to pull nested data current and previous from data.json file through json-server. I wanted to do that dynamically, for example;
<span className="main__task-current">
        {`stat.timeframes.${frequency}.current}hrs
</span>

However, it didn't work. Is there any methods to make "frequency" dynamic?

  • Should I map through <button> elements in FrequencySelctor.js? I could not figure out how, but I had feeling that I may have been able to.

There's so many questions but I hope someone can kindly help me.

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 Yuko Horita'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
  • Use cases

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