-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: transparency profiles go to profile page (#1206)
- Loading branch information
Showing
3 changed files
with
17 additions
and
33 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 |
---|---|---|
@@ -1,27 +1,24 @@ | ||
import React, { useMemo } from 'react' | ||
|
||
import { Member } from '../../clients/DclData' | ||
import locations from '../../utils/locations' | ||
import Avatar from '../Common/Avatar' | ||
import Link from '../Common/Typography/Link' | ||
|
||
import './MemberCard.css' | ||
|
||
export type MemberCardProps = React.HTMLAttributes<HTMLDivElement> & { | ||
member: { | ||
avatar: string | ||
name: string | ||
} | ||
interface Props { | ||
member: Member | ||
} | ||
|
||
export default function MemberCard({ member }: MemberCardProps) { | ||
const color = useMemo( | ||
() => (member.name.split('').reduce((a, b) => a + b.charCodeAt(0), 0) % 16).toString(16), | ||
[member.name] | ||
) | ||
export default function MemberCard({ member }: Props) { | ||
const { name, address, avatar } = member | ||
const color = useMemo(() => (name.split('').reduce((a, b) => a + b.charCodeAt(0), 0) % 16).toString(16), [name]) | ||
|
||
return ( | ||
<div className="MemberCard"> | ||
<Avatar src={member.avatar} size="medium" address={'0x' + color} /> | ||
<div className="MemberCard_description"> | ||
<span>{member.name}</span> | ||
</div> | ||
</div> | ||
<Link className="MemberCard" href={locations.profile({ address })}> | ||
<Avatar src={avatar} size="medium" address={'0x' + color} /> | ||
<div className="MemberCard__Description">{name}</div> | ||
</Link> | ||
) | ||
} |
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