Skip to content

Commit

Permalink
Tokens: update logic for showing 'YOU' in InfoBox
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai committed Jun 9, 2020
1 parent cf91af0 commit 9e7cd31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
22 changes: 15 additions & 7 deletions apps/token-manager/app/src/components/InfoBoxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,26 @@ function InfoBoxes({
const isCurrentUser = addressesEqual(account, connectedAccount)
const [label] = useIdentity(account)

const identityBadgeProps = {
defaultLabel: !Boolean(label) && isCurrentUser ? 'YOU' : '',
labelStyle: isCurrentUser ? '' + (Boolean(label) ? 'max-width: 83px;' : `color: ${theme.tagIndicatorContent};` ) : 'max-width: 117px;'
}
return (
<div>
<div
css={`
display: flex;
align-items: center;
`}
>
<LocalIdentityBadge
entity={account}
connectedAccount={isCurrentUser}
{...identityBadgeProps}
defaultLabel="YOU"
labelStyle={
isCurrentUser && !label
? `color: ${theme.tagIndicatorContent};`
: ''
}
/>
{isCurrentUser && Boolean(label) && <You />}
{isCurrentUser && Boolean(label) && (
<You css="flex-shrink: 0;" />
)}
</div>
)
}}
Expand Down
3 changes: 2 additions & 1 deletion apps/token-manager/app/src/components/You.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react'
import { Tag, GU } from '@aragon/ui'

const You = () => (
const You = props => (
<Tag
css={`
margin-left: ${0.5 * GU}px;
`}
size="small"
{...props}
>
you
</Tag>
Expand Down
2 changes: 1 addition & 1 deletion apps/token-manager/app/src/screens/Holders.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Holders({
entity={address}
connectedAccount={isCurrentUser}
/>
{isCurrentUser && <You />}
{isCurrentUser && <You css="flex-shrink: 0" />}
</div>,
]

Expand Down

0 comments on commit 9e7cd31

Please sign in to comment.