nickHeader.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { connect } from "react-redux";
  2. import ConnectedAvaLogo from "./ava";
  3. import { actionAuthLogout } from "../actions/actionAuthLogout";
  4. import { Redirect } from "react-router";
  5. import { Link } from "react-router-dom";
  6. const NickName = ({nick, onLogOut}) => {
  7. return (
  8. <>
  9. <div style={{position: "relative", left: "50%", paddingTop:"10px"}}>
  10. <div>
  11. <span style={{color: "black"}}>Your nickname </span>
  12. <a href="/cabinet" style={{textDecoration: "none", color: "#5F9EA0"}}>
  13. {nick} &nbsp;&nbsp;
  14. <ConnectedAvaLogo px={"50px"} mrgn={"10px"} />
  15. </a>
  16. <button className="btn btn-secondary btn-sm" onClick={() => onLogOut()}>
  17. Log out
  18. </button>
  19. </div>
  20. <div style={{}}>
  21. <Link to = "/search">
  22. <button className="btn btn-info btn-sm">Search</button>
  23. </Link>
  24. </div>
  25. </div>
  26. </>
  27. );
  28. };
  29. const ConnectedNick = connect(
  30. (state) => ({ nick: state?.auth?.payload?.sub?.login , logedIn: state.auth.token}),
  31. { onLogOut: actionAuthLogout }
  32. )(NickName);
  33. export default ConnectedNick;