aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-05 12:46:18 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit94741fb25dd6c60571e78393c43355d8ddf8b64d (patch)
tree850eb48d49291f612be088cee22012cf64b3f1d1 /vnext/src
parentde266f3bf9c92c425a4050acd76106ccb48c5b37 (diff)
AvatarLink
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/App.js4
-rw-r--r--vnext/src/components/Avatar.js11
2 files changed, 12 insertions, 3 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js
index 5726c511..5b343c0a 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -11,7 +11,7 @@ import Chat from './components/Chat';
import Post from './components/Post';
import Thread from './components/Thread';
import LoginButton from './components/LoginButton';
-import Avatar from './components/Avatar';
+import { AvatarLink } from './components/Avatar';
import Header from './components/Header';
import SearchBox from './components/SearchBox';
@@ -91,7 +91,7 @@ export default class App extends React.Component {
<div id="header_wrapper">
{user.uid > 0 ?
<div id="ctitle">
- {user.uname ? <Avatar user={user} /> : <Icon name="ei-spinner" size="m" />}
+ {user.uname ? <AvatarLink user={user} /> : <Icon name="ei-spinner" size="m" />}
</div>
:
<div id="logo"><Link to="/">Juick</Link></div>
diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js
index 31d7dd34..c42a048a 100644
--- a/vnext/src/components/Avatar.js
+++ b/vnext/src/components/Avatar.js
@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
import { UserType } from './Types';
-const Avatar = React.memo(function AvatarComponent(props) {
+const Avatar = React.memo(props => {
return (
<div style={{ display: 'flex' }}>
<div className="msg-avatar">
@@ -26,6 +26,15 @@ const Avatar = React.memo(function AvatarComponent(props) {
export default Avatar;
+export const AvatarLink = React.memo(props => {
+ return (
+ <Link to={{ pathname: props.link || `/${props.user.uname}/` }}>
+ <img src={`//i.juick.com/a/${props.user.uid}.png`} alt={`${props.user.uname}`} />
+ {props.user.uname}
+ </Link>
+ );
+});
+
Avatar.propTypes = {
user: UserType,
link: PropTypes.string,