[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.4 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import React, { FC } from 'react'
  2. import { Link } from 'react-router-dom'
  3. import { useSelector, useDispatch } from 'react-redux'
  4. import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
  5. import { faStream, faPaperPlane, faSun, faMoon } from '@fortawesome/free-solid-svg-icons'
  6. import { useTheme } from '../hooks'
  7. import { setColorScheme } from '../actions/theme'
  8. import { getColorScheme } from '../selectors/theme'
  9. import { ColorScheme } from '../types'
  10. const NavigationMenu: FC = () => {
  11. const theme = useTheme()
  12. const scheme = useSelector(getColorScheme)
  13. const dispatch = useDispatch()
  14. const switchColorSchemeItem = () => {
  15. switch (scheme) {
  16. case ColorScheme.Light:
  17. return (
  18. <a style={{ color: theme.primary, cursor: 'pointer' }} onClick={() => dispatch(setColorScheme(ColorScheme.Dark))}>
  19. <span className="icon" style={{ color: theme.primary }}>
  20. <FontAwesomeIcon icon={faMoon} />
  21. </span>
  22. &nbsp;
  23. <span>Dark Mode</span>
  24. </a>
  25. )
  26. case ColorScheme.Dark:
  27. return (
  28. <a style={{ color: theme.primary, cursor: 'pointer' }} onClick={() => dispatch(setColorScheme(ColorScheme.Light))}>
  29. <span className="icon" style={{ color: theme.primary }}>
  30. <FontAwesomeIcon icon={faSun} />
  31. </span>
  32. &nbsp;
  33. <span>Light Mode</span>
  34. </a>
  35. )
  36. }
  37. }
  38. return (
  39. <nav>
  40. <div>
  41. <span className="icon" style={{ color: theme.primary }}>
  42. <FontAwesomeIcon icon={faStream} />
  43. </span>
  44. &nbsp;
  45. <Link style={{ color: theme.primary }} to="/">Timeline</Link>
  46. </div>
  47. <div>
  48. <span className="icon" style={{ color: theme.primary }}>
  49. <FontAwesomeIcon icon={faPaperPlane} />
  50. </span>
  51. &nbsp;
  52. <Link style={{ color: theme.primary }} to="/apps">Apps</Link>
  53. </div>
  54. <div>
  55. {switchColorSchemeItem()}
  56. </div>
  57. </nav>
  58. )
  59. }
  60. export default NavigationMenu