feat: link to user profile from name

This commit is contained in:
Alejandro Gomez 2023-01-06 12:04:25 +01:00
parent ae133130ef
commit 8b37980da3
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
2 changed files with 16 additions and 5 deletions

View File

@ -9,4 +9,12 @@
margin-right: 20px; margin-right: 20px;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
} }
.pfp a {
text-decoration: none;
}
.pfp a:hover {
text-decoration: underline;
}

View File

@ -1,8 +1,11 @@
import "./ProfileImage.css"; import { useMemo } from "react";
import { useNavigate } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom";
import useProfile from "../feed/ProfileFeed"; import useProfile from "../feed/ProfileFeed";
import Nostrich from "../nostrich.jpg"; import Nostrich from "../nostrich.jpg";
import { useMemo } from "react";
import "./ProfileImage.css";
export default function ProfileImage(props) { export default function ProfileImage(props) {
const pubkey = props.pubkey; const pubkey = props.pubkey;
@ -24,7 +27,7 @@ export default function ProfileImage(props) {
<div className="pfp"> <div className="pfp">
<img src={hasImage ? user.picture : Nostrich} onClick={() => navigate(`/p/${pubkey}`)} /> <img src={hasImage ? user.picture : Nostrich} onClick={() => navigate(`/p/${pubkey}`)} />
<div> <div>
{name} <Link key={pubkey} to={`/p/${pubkey}`}>{name}</Link>
{subHeader ? <div>{subHeader}</div> : null} {subHeader ? <div>{subHeader}</div> : null}
</div> </div>
</div> </div>