Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit b8b602e

Browse files
authored
HOW-59 show user avatar (#100)
HOW-59 show user avatar
2 parents 139d8ff + 8f4246e commit b8b602e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/api/account.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ export type CurrentUser = {|
55
id: number,
66
displayName: string,
77
email: string,
8+
avatar: string,
89
|}
910

1011
export type ExternalUser = {|
1112
id: number,
1213
displayName: string,
14+
avatar: string,
1315
|}
1416

1517
export type User = ExternalUser | CurrentUser

src/pages/users/current/page.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ UserPage.propTypes = {
103103
const UserInfo = ({ user }) =>
104104
user ? (
105105
<Col gap="1rem">
106+
<Avatar src={`${user.avatar}&s=512`} />
106107
<Row>
107108
<H3 narrow>{user.displayName || user.id}</H3>
108109
</Row>
@@ -115,13 +116,21 @@ UserInfo.propTypes = {
115116
id: PropTypes.number.isRequired,
116117
email: PropTypes.string,
117118
displayName: PropTypes.string,
119+
avatar: PropTypes.string,
118120
}),
119121
}
120122

121123
UserInfo.defaultProps = {
122124
user: null,
123125
}
124126

127+
const Avatar = styled.img`
128+
width: 320px;
129+
height: 320px;
130+
display: block;
131+
border: 1px solid var(--bw50);
132+
`
133+
125134
const CurrentUserInfo = ({ user }) =>
126135
user.email ? <Row>You: {user.email}</Row> : null
127136

0 commit comments

Comments
 (0)