sider.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React, { useContext } from 'react';
  2. import { NavLink as NavLinkRouter } from "react-router-dom";
  3. import {store} from "../../context/store";
  4. import {USER_LOGGED_OUT} from "../../context/actionType";
  5. import { Menu } from 'antd';
  6. export default function SideMenu(props) {
  7. const {isLoggedIn, userName, dispatch} = useContext(store);
  8. const onLogout = () => {
  9. dispatch({type: USER_LOGGED_OUT})
  10. }
  11. return (
  12. <div style={{ backgroundColor: "#002329", color: "white" }}>
  13. <div className="text-right p-3" style={{ minHeight: "150px" }}>
  14. <div className="d-flex justify-content-between" style={{ minHeight: "150px" }}>
  15. <div>
  16. <h4 className="text-white">
  17. <NavLinkRouter className="text-white text-decoration-none" to="/">
  18. پورتال
  19. </NavLinkRouter>
  20. </h4>
  21. </div>
  22. <div className="align-self-end">
  23. <span className="pointer" onClick={() => onLogout()} >خروج از حساب</span>
  24. </div>
  25. </div>
  26. </div>
  27. <Menu
  28. mode="inline"
  29. // defaultSelectedKeys={['1']}
  30. style={{ height: '100%', borderRight: 0, backgroundColor: "#002329", color: "white" }}
  31. >
  32. <Menu.Item key="1">
  33. <NavLinkRouter className="text-white text-decoration-none" to="/exams">
  34. آزمون ها
  35. </NavLinkRouter>
  36. </Menu.Item>
  37. <Menu.Item key="2">
  38. <NavLinkRouter className="text-white text-decoration-none" to="/sets">
  39. امتحانات
  40. </NavLinkRouter>
  41. </Menu.Item>
  42. <Menu.Item key="3">
  43. <NavLinkRouter className="text-white text-decoration-none" to="/questions">
  44. سوالات
  45. </NavLinkRouter>
  46. </Menu.Item>
  47. <Menu.Item key="4">
  48. <NavLinkRouter className="text-white text-decoration-none" to="/tenants">
  49. مدارس
  50. </NavLinkRouter>
  51. </Menu.Item>
  52. </Menu>
  53. </div>
  54. )
  55. }