rwieruch / favesound-redux

🎶 A SoundCloud Client in React + Redux running in production. Live Demo and Source Code to explore React + Redux as a beginner.
http://www.robinwieruch.de/the-soundcloud-client-in-react-redux/
1.59k stars 249 forks source link

Add-a-link-to-dashboard #111

Closed ElishebaW closed 6 years ago

ElishebaW commented 6 years ago

This pull request adds the dashboard link to the header so that the user doesn't have to enter the URL to navigate to the dashboard when logged in. @rwieruch

screen shot 2017-12-30 at 9 51 58 pm

rwieruch commented 6 years ago

@ElishebaW looks almost good to me! Do you think it's possible to have "Dashboard" and "Logout" side by side on the right side? Now there are 4 areas: Logo | Genres | Logout?Login | Dashboard. But I think it would be more common to have 3 Areas: Logo | Genres | Dashboard, Logout/Login whereas the user settings (e.g. login, logout) are on the right side of the navbar.

ElishebaW commented 6 years ago

@rwieruch Sure thing!

I was running into some problems where I couldn't add two expressions to the ternary operation when the condition evaluates to true.

I thought about using an if/else statement, but you can't do that with JSX and I don't think it would have solved my problem anyway. https://react-cn.github.io/react/tips/if-else-in-JSX.html

So I wrapped the two links in divs and used CSS to bring them closer together.

screen shot 2017-12-31 at 3 42 50 pm

If you know of a better solution, I would love to learn something new!

rwieruch commented 6 years ago

Hey @ElishebaW Looks good to me! Thanks for your contribution 🎉

It's always difficult to decide what's the best solution when it comes to aligning components. But I think yours is fitting well! Perhaps another good read for conditional renderings beyond if-else statements is this one: https://www.robinwieruch.de/conditional-rendering-react/ Not sure if you have read it already, but it gives you a handful of neat options!

I wish you a happy new year!

ElishebaW commented 6 years ago

@rwieruch Thanks! I bookmarked the article for future reference!