Nerds-Who-Code / Mental-Health-Tracker

mental-health-tracker.vercel.app
MIT License
6 stars 6 forks source link

Add default nav buttons component #60

Closed steph-koopmanschap closed 1 year ago

steph-koopmanschap commented 2 years ago

Taking advantage of re-usable React components. The same kind code kept being repeated. Namely the navigational buttons that all have the same design. So I made a React component out of it and replaced all the repeating code with the component.

Example on how to use it:

<NavBtnDefault link="/dashboard" btnText="Go back to dashboard" />

The above component does the exact same as the below code

  <Link to=/dashboard">
      <button
          className='bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none mx-2'>
          Go back to dashboard
      </button>
  </Link>

Added file: NavBtnDefault.js in the components folder.

This pull request does not make any functional changes to the code or the design. Its basically just a refactoring of the DRY (dont repeat yourself) principle. Everything should work and look exactly as before.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
mental-health-tracker ✅ Ready (Inspect) Visit Preview Oct 5, 2022 at 8:59AM (UTC)
nab-sa commented 1 year ago

Looks good for me too, the only problem is replacing the chartjs library to plotly