-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a02cf09
commit d017d7c
Showing
6 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Avatar, Card, Divider, Space } from "antd"; | ||
import { AVATAR_FILES_PREFIX, getOtherUser } from "../service/user"; | ||
import { useEffect, useState } from "react"; | ||
|
||
export default function OtherUserProfile({ userId }) { | ||
const [user, setUser] = useState(null); | ||
|
||
useEffect(() => { | ||
getOtherUser(userId).then(setUser); | ||
}, [userId]); | ||
|
||
return <Card style={{ width: "50%", margin: "20px auto 0" }}> | ||
<Space direction="vertical" style={{ textAlign: "center", width: "100%" }} size={2}> | ||
<Avatar | ||
src={user?.avatar ? (AVATAR_FILES_PREFIX + user.avatar) : "/default_avatar.jpeg"} | ||
style={{ width: "100px", height: "100px" }} | ||
/> | ||
<span style={{ fontSize: 20 }}>{user?.nickname}</span> | ||
<span style={{ fontSize: 14, color: "grey" }}>{user?.introduction ? user.introduction : "这个人很懒,什么也没留下"}</span> | ||
</Space> | ||
<Divider /> | ||
<Space direction="vertical"> | ||
<span style={{ fontSize: 16, color: "#222222" }}>用户名:{user?.username}</span> | ||
</Space> | ||
</Card > | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useParams } from "react-router-dom"; | ||
import { PrivateLayout } from "../components/layout"; | ||
import OtherUserProfile from "../components/other_user_profile"; | ||
|
||
export default function OtherUserProfilePage() { | ||
const { id } = useParams(); | ||
|
||
return <PrivateLayout> | ||
<OtherUserProfile userId={id} /> | ||
</PrivateLayout> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters