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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import Box from '@mui/material/Box';
  2. import Image from 'next/image';
  3. import Link from 'next/link';
  4. import { CART_PAGE, PROFILE_PAGE } from '../../../constants/pages';
  5. import { NavItemDesktop } from './NavItem';
  6. import { items } from './navItems';
  7. const DesktopNav = ({ router, totalQuantity, session, signOutHandler }) => {
  8. return (
  9. <Box sx={{ display: { xs: 'none', md: 'flex' }, width: '100%' }}>
  10. <Box
  11. sx={{
  12. flexGrow: 1,
  13. maxWidth: '50%',
  14. height: 30,
  15. display: 'flex',
  16. justifyContent: 'space-between',
  17. }}
  18. >
  19. {items.map((item) => (
  20. <NavItemDesktop
  21. key={item.id}
  22. router={router}
  23. name={item.name}
  24. url={item.url}
  25. />
  26. ))}
  27. </Box>
  28. <Box
  29. sx={{
  30. flexGrow: 1,
  31. maxWidth: '50%',
  32. height: 30,
  33. display: 'flex',
  34. justifyContent: 'right',
  35. pt: 0.5,
  36. mr: 4,
  37. }}
  38. >
  39. {session?.user?._id && (
  40. <Box
  41. sx={{
  42. mx: 2,
  43. mt: 0.1,
  44. cursor: 'pointer',
  45. }}
  46. onClick={signOutHandler}
  47. >
  48. <Image
  49. src="/images/logout.svg"
  50. alt="profile"
  51. width={18}
  52. height={20}
  53. />
  54. </Box>
  55. )}
  56. <Box
  57. sx={{
  58. mx: 2,
  59. cursor: 'pointer',
  60. }}
  61. >
  62. <Link key="home" href={PROFILE_PAGE}>
  63. <Image
  64. src="/images/profile.svg"
  65. alt="profile"
  66. width={24}
  67. height={24}
  68. />
  69. </Link>
  70. </Box>
  71. <Box
  72. sx={{
  73. mr: 6,
  74. ml: 2,
  75. cursor: 'pointer',
  76. }}
  77. >
  78. <Link key="home" href={CART_PAGE}>
  79. <Box>
  80. {totalQuantity !== 0 && (
  81. <Box
  82. sx={{
  83. color: 'white',
  84. zIndex: 3,
  85. width: 20,
  86. height: 20,
  87. borderRadius: 20,
  88. textAlign: 'center',
  89. px: 0.5,
  90. ml: 2.2,
  91. mt: -1,
  92. fontSize: 17,
  93. position: 'absolute',
  94. backgroundColor: 'primary.main',
  95. }}
  96. >
  97. {totalQuantity}
  98. </Box>
  99. )}
  100. <Image src="/images/cart.svg" alt="cart" width={24} height={24} />
  101. </Box>
  102. </Link>
  103. </Box>
  104. </Box>
  105. </Box>
  106. );
  107. };
  108. export default DesktopNav;