Skip to content

Commit 7261188

Browse files
committed
Update UserLinks to correctly contain and center text
1 parent 984be7a commit 7261188

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed

packages/web/src/components/collection/CollectionCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const CollectionCard = forwardRef(
135135
<Text ellipses>{playlist_name}</Text>
136136
</TextLink>
137137
<Flex justifyContent='center'>
138-
<UserLink userId={playlist_owner_id!} popover />
138+
<UserLink userId={playlist_owner_id!} popover center />
139139
</Flex>
140140
</CardContent>
141141
</Flex>

packages/web/src/components/collection/desktop/CollectionHeader.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,17 @@ export const CollectionHeader = (props: CollectionHeaderProps) => {
243243
{isLoading ? (
244244
<Skeleton height='24px' width='150px' />
245245
) : userId !== null ? (
246-
<Text variant='title' strength='weak' tag='h2' textAlign='left'>
246+
<Text
247+
css={{
248+
display: 'flex',
249+
alignItems: 'center',
250+
gap: spacing.xs
251+
}}
252+
variant='title'
253+
strength='weak'
254+
tag='h2'
255+
textAlign='left'
256+
>
247257
<Text color='subdued'>{messages.by}</Text>
248258
<UserLink userId={userId} popover variant='visible' />
249259
</Text>

packages/web/src/components/link/UserLink.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type UserLinkProps = Omit<TextLinkProps, 'to'> & {
2424
noBadges?: boolean
2525
// Hack to fix avatars wrapped in user link
2626
noOverflow?: boolean
27+
center?: boolean
2728
}
2829

2930
export const UserLink = (props: UserLinkProps) => {
@@ -36,6 +37,7 @@ export const UserLink = (props: UserLinkProps) => {
3637
noText,
3738
noBadges,
3839
noOverflow,
40+
center,
3941
...other
4042
} = props
4143
const { spacing } = useTheme()
@@ -77,6 +79,8 @@ export const UserLink = (props: UserLinkProps) => {
7779
// In new UI, badges should be outside the TextLink to prevent hover effects on badges
7880
const textLink = isWalletUIUpdate ? (
7981
<Flex
82+
w='100%'
83+
justifyContent={center ? 'center' : undefined}
8084
css={{
8185
columnGap: spacing.xs,
8286
alignItems: 'center',
@@ -138,6 +142,8 @@ export const UserLink = (props: UserLinkProps) => {
138142
if (isWalletUIUpdate && popover && handle && !noText) {
139143
return (
140144
<Flex
145+
w='100%'
146+
justifyContent={center ? 'center' : undefined}
141147
css={{
142148
columnGap: spacing.xs,
143149
alignItems: 'center',

packages/web/src/components/nav/desktop/AccountDetails.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,24 @@ const SignedInView = ({
110110
<Avatar userId={userId} h={48} w={48} />
111111
<AccountInfo>
112112
<Flex alignItems='center' justifyContent='space-between' gap='s' h={20}>
113-
<UserLink
114-
textVariant='title'
115-
size='s'
116-
userId={userId}
117-
badgeSize='xs'
118-
css={{
119-
flex: 1,
120-
overflow: 'hidden',
121-
textOverflow: 'ellipsis',
122-
wordBreak: 'break-word',
123-
...(isManagedAccount && {
124-
color: color.secondary.s500,
125-
'&:hover': { color: color.secondary.s500 }
126-
})
127-
}}
128-
/>
113+
<Flex css={{ maxWidth: '85%' }}>
114+
<UserLink
115+
textVariant='title'
116+
size='s'
117+
userId={userId}
118+
badgeSize='xs'
119+
css={{
120+
flex: 1,
121+
overflow: 'hidden',
122+
textOverflow: 'ellipsis',
123+
wordBreak: 'break-word',
124+
...(isManagedAccount && {
125+
color: color.secondary.s500,
126+
'&:hover': { color: color.secondary.s500 }
127+
})
128+
}}
129+
/>
130+
</Flex>
129131
<AccountSwitcher />
130132
</Flex>
131133
<TextLink

packages/web/src/components/user-card/UserCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const UserCard = (props: UserCardProps) => {
8585
userId={id}
8686
textVariant='title'
8787
size='l'
88-
css={{ justifyContent: 'center' }}
88+
center
8989
onClick={onUserLinkClick}
9090
/>
9191
<Text variant='body' ellipses css={{ textAlign: 'center' }}>

packages/web/src/pages/explore-page/components/desktop/CollectionArtCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const CollectionArtCard = ({ id }: CollectionArtCardProps) => {
4949
popover
5050
textVariant='title'
5151
strength='weak'
52+
center
5253
/>
5354
</Flex>
5455
<Flex gap='m'>

0 commit comments

Comments
 (0)