Skip to content

Commit

Permalink
fix(rn): badge for account
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Mar 21, 2019
1 parent 9d3cda0 commit 71bda4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
22 changes: 12 additions & 10 deletions client/react-native/common/components/Library/Badge.js
Expand Up @@ -43,27 +43,27 @@ const getPadding = (
paddings = {
tiny: 1,
small: 2,
medium: 4,
large: 5,
big: 6,
medium: 7,
large: 9,
big: 12,
}
) => find({ inside: props, from: paddings, or: 'small' })

const getHorizAbsol = (
props,
padding = getPadding(props),
size = getSize(props),
positions = {
top: { top: -padding },
bottom: { bottom: -padding },
top: { top: 0 },
bottom: { bottom: 0 },
}
) => find({ inside: props, from: positions, or: 'top' })

const getVertiAbsol = (
props,
padding = getPadding(props),
size = getSize(props),
positions = {
left: { left: -padding },
right: { right: -padding },
left: { left: 0 },
right: { right: 0 },
}
) => find({ inside: props, from: positions, or: 'right' })

Expand All @@ -85,7 +85,9 @@ const Badge = props => {
getHorizPos(props),
getVertiPos(props),
typeof props.getSize === 'function' ? props.getSize(props) : getSize(props),
typeof props.getPadding === 'function' ? props.getPadding(props) : getPadding(props),
typeof props.getPadding === 'function'
? props.getPadding(props)
: getPadding(props),
{ ...getHorizAbsol(props), ...getVertiAbsol(props) },
]

Expand Down
Expand Up @@ -92,14 +92,16 @@ class ListBase extends PureComponent {
<Menu absolute>
<Menu.Header
icon={
<Badge
background={colors.blue}
icon={edit && 'camera'}
medium
onPress={this.onChoosePicture}
>
<Avatar data={conversation} uri={this.state.uri} size={78} />
</Badge>
edit && (
<Badge
background={colors.blue}
icon={'camera'}
medium
onPress={this.onChoosePicture}
>
<Avatar data={conversation} uri={this.state.uri} size={78} />
</Badge>
)
}
title={!edit && title}
description={
Expand Down

0 comments on commit 71bda4e

Please sign in to comment.