Skip to content

Commit

Permalink
move from address and label into a separate component
Browse files Browse the repository at this point in the history
  • Loading branch information
lykalabrada committed Nov 1, 2023
1 parent b92e7d9 commit 70c61ec
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions mobile-app/app/components/SummaryTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,10 @@ export function SummaryTitle(props: ISummaryTitleProps): JSX.Element {
customStyle="flex flex-row items-center rounded-full pr-2.5 py-1 ml-2 overflow-hidden"
testID="from_address_label"
>
<>
<RandomAvatar name={props.fromAddress} size={20} />
<ThemedTextV2
ellipsizeMode="middle"
numberOfLines={1}
style={[
tailwind("text-sm font-normal-v2 ml-1"),
// eslint-disable-next-line react-native/no-inline-styles
{ minWidth: 10, maxWidth: 108 },
]}
testID="wallet_address"
>
{props.fromAddressLabel ?? props.fromAddress}
</ThemedTextV2>
</>
<FromAddress
fromAddress={props.fromAddress}
fromAddressLabel={props.fromAddressLabel}
/>
</AddressEvmTag>
) : (
// DVM from address
Expand All @@ -131,19 +120,10 @@ export function SummaryTitle(props: ISummaryTitleProps): JSX.Element {
"rounded-full pl-1 pr-2.5 py-1 flex flex-row items-center overflow-hidden ml-2",
)}
>
<RandomAvatar name={props.fromAddress} size={20} />
<ThemedTextV2
ellipsizeMode="middle"
numberOfLines={1}
style={[
tailwind("text-sm font-normal-v2 ml-1"),
// eslint-disable-next-line react-native/no-inline-styles
{ minWidth: 10, maxWidth: 108 },
]}
testID="wallet_address"
>
{props.fromAddressLabel ?? props.fromAddress}
</ThemedTextV2>
<FromAddress
fromAddress={props.fromAddress}
fromAddressLabel={props.fromAddressLabel}
/>
</ThemedViewV2>
)}
</View>
Expand Down Expand Up @@ -236,3 +216,26 @@ export function SummaryTitle(props: ISummaryTitleProps): JSX.Element {
</>
);
}

function FromAddress(props: {
fromAddress: string;
fromAddressLabel?: string | null;
}): JSX.Element {
return (
<>
<RandomAvatar name={props.fromAddress} size={20} />
<ThemedTextV2
ellipsizeMode="middle"
numberOfLines={1}
style={[
tailwind("text-sm font-normal-v2 ml-1"),
// eslint-disable-next-line react-native/no-inline-styles
{ minWidth: 10, maxWidth: 108 },
]}
testID="wallet_address"
>
{props.fromAddressLabel ?? props.fromAddress}
</ThemedTextV2>
</>
);
}

0 comments on commit 70c61ec

Please sign in to comment.