Update Avatar component (#385)
* revert text changes * check 'none' * rm cloneElement * use 'none' as val
This commit is contained in:
parent
1df8c16091
commit
0b6badac48
|
@ -203,16 +203,10 @@ const Avatar = (props: AvatarProps) => {
|
|||
<Fallback borderRadius={radius} backgroundColor={backgroundColor}>
|
||||
{/* todo?: contrasting color to background */}
|
||||
{props.type === 'group' ? (
|
||||
cloneElement(
|
||||
<MembersIcon
|
||||
size={
|
||||
groupMembersIconSizes[props.size] as IconProps['size']
|
||||
}
|
||||
/>,
|
||||
{
|
||||
color: '$white-100',
|
||||
}
|
||||
)
|
||||
<MembersIcon
|
||||
size={groupMembersIconSizes[props.size] as IconProps['size']}
|
||||
color="$white-100"
|
||||
/>
|
||||
) : (
|
||||
<Text
|
||||
size={textSizes[props.size]}
|
||||
|
@ -285,13 +279,15 @@ const Avatar = (props: AvatarProps) => {
|
|||
const renderBadge = () => {
|
||||
switch (props.type) {
|
||||
case 'user': {
|
||||
if (!props.indicator) {
|
||||
const { indicator = 'none', size } = props
|
||||
|
||||
if (!indicator || indicator === 'none') {
|
||||
return
|
||||
}
|
||||
|
||||
return (
|
||||
<Unspaced>
|
||||
<Indicator size={props.size} state={props.indicator} />
|
||||
<Indicator size={size} state={indicator} />
|
||||
</Unspaced>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ type Weight = NonNullable<Variants['weight']>
|
|||
|
||||
type Props = {
|
||||
children: React.ReactNode
|
||||
size?: 27 | 19 | 15 | 13 | 11 | undefined
|
||||
color?: ColorTokens
|
||||
truncate?: boolean
|
||||
wrap?: false
|
||||
|
@ -27,8 +26,8 @@ type Props = {
|
|||
// TODO: monospace should be used only for variant. Extract to separate <Address> component?
|
||||
// TODO: Ubuntu Mono should be used only for code snippets. Extract to separate <Code> component?
|
||||
const Text = (props: Props, ref: Ref<RNText>) => {
|
||||
const { color = '$neutral-100', size = 13, ...rest } = props
|
||||
return <Base {...rest} ref={ref} color={color} size={size} />
|
||||
const { color = '$neutral-100', ...rest } = props
|
||||
return <Base {...rest} ref={ref} color={color} />
|
||||
}
|
||||
|
||||
const Base = styled(BaseText, {
|
||||
|
|
Loading…
Reference in New Issue