-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seperate round PFP into own component exchange useEffect & useState w…
…ith useMemo
- Loading branch information
1 parent
2449c1f
commit d444133
Showing
4 changed files
with
38 additions
and
15 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
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
32 changes: 32 additions & 0 deletions
32
packages/web/components/Player/PlayerProfilePictureRound.tsx
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,32 @@ | ||
import type { AvatarProps } from '@metafam/ds'; | ||
import { RoundImage } from 'components/RoundImage'; | ||
import type { Player } from 'graphql/autogen/types'; | ||
import type { GuildPlayer } from 'graphql/types'; | ||
import { useProfileField } from 'lib/hooks'; | ||
import React from 'react'; | ||
import { getPlayerImage } from 'utils/playerHelpers'; | ||
|
||
type PlayerProfilePictureProps = AvatarProps & { | ||
player?: Player | GuildPlayer; | ||
}; | ||
|
||
export const PlayerProfilePictureRound: React.FC<PlayerProfilePictureProps> = ({ | ||
player: user, | ||
src: source, | ||
...props | ||
}) => { | ||
const player = user as Player; | ||
const { value: image } = useProfileField({ | ||
field: 'profileImageURL', | ||
player, | ||
getter: getPlayerImage, | ||
}); | ||
|
||
const src = source ?? image ?? undefined; | ||
|
||
return ( | ||
<> | ||
<RoundImage {...{ src, ...props }} /> | ||
</> | ||
); | ||
}; |