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.

UserProfile.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Button, Typography } from "@mui/material";
  2. import { Box } from "@mui/system";
  3. import LogoutIcon from "@mui/icons-material/Logout";
  4. import React from "react";
  5. import { useTranslation } from "react-i18next";
  6. import avatarLogo from "../../assets/images/Avatar.png";
  7. import PropTypes from "prop-types";
  8. import { useDispatch, useSelector } from "react-redux";
  9. import { logoutUser } from "../../store/actions/login/loginActions";
  10. const UserProfile = ({ show, innerRef }) => {
  11. const { t } = useTranslation();
  12. const dispatch = useDispatch();
  13. // const theme = useTheme();
  14. // const matches = useMediaQuery(theme.breakpoints.down("sm"));
  15. const { user } = useSelector((s) => s.user);
  16. const logout = () => {
  17. dispatch(logoutUser());
  18. };
  19. return (
  20. <Box className={`user-view flex-center ${show && "active"}`}>
  21. <div
  22. ref={innerRef}
  23. className="flex-center flex-col"
  24. style={{ width: "90%" }}
  25. >
  26. <img src={avatarLogo} width="64px" height="64px" />
  27. <Typography
  28. variant="h5"
  29. sx={{ fontSize: "18px", marginTop: "15px" }}
  30. className="text-blue"
  31. >
  32. {user.firstName + " " + user.lastName}
  33. </Typography>
  34. <Typography
  35. variant="body1"
  36. sx={{ fontSize: "14px", marginTop: "8px" }}
  37. className="text-grey9d"
  38. >
  39. HR Specialist
  40. </Typography>
  41. {/* <div className="hr" style={{ width: "90%", marginTop: "18px" }}></div> */}
  42. <Button
  43. sx={{
  44. padding: "18px 72px",
  45. border: "1px solid #226cb0",
  46. borderRadius: "9px",
  47. background: "white",
  48. width: "90%",
  49. marginTop: "50px",
  50. }}
  51. onClick={logout}
  52. startIcon={<LogoutIcon />}
  53. >
  54. {t("nav.signOut")}
  55. </Button>
  56. </div>
  57. </Box>
  58. );
  59. };
  60. UserProfile.propTypes = {
  61. show: PropTypes.any,
  62. innerRef: PropTypes.any,
  63. };
  64. export default UserProfile;