-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(suite-native): icon list item used in analytics screen
- Loading branch information
Showing
1 changed file
with
12 additions
and
33 deletions.
There are no files selected for viewing
45 changes: 12 additions & 33 deletions
45
suite-native/module-onboarding/src/components/AnalyticsInfoRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,21 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { Box, HStack, Text, VStack } from '@suite-native/atoms'; | ||
import { Icon, IconName } from '@suite-native/icons'; | ||
import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; | ||
import { IconListItem, Text, VStack } from '@suite-native/atoms'; | ||
import { IconName } from '@suite-native/icons'; | ||
|
||
type AnalyticsInfoRowProps = { | ||
iconName: IconName; | ||
title: ReactNode; | ||
description: ReactNode; | ||
}; | ||
|
||
const WRAPPER_SIZE = 36; | ||
|
||
const iconWrapper = prepareNativeStyle(utils => ({ | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: WRAPPER_SIZE, | ||
height: WRAPPER_SIZE, | ||
backgroundColor: utils.colors.backgroundSurfaceElevation2, | ||
borderRadius: utils.borders.radii.r12, | ||
borderWidth: 1, | ||
borderColor: utils.colors.backgroundTertiaryDefaultOnElevation0, | ||
})); | ||
|
||
export const AnalyticsInfoRow = ({ iconName, title, description }: AnalyticsInfoRowProps) => { | ||
const { applyStyle } = useNativeStyles(); | ||
|
||
return ( | ||
<HStack spacing="sp12" flexDirection="row" alignItems="center"> | ||
<Box style={applyStyle(iconWrapper)}> | ||
<Icon name={iconName} size="mediumLarge" /> | ||
</Box> | ||
<VStack spacing="sp4" flex={1}> | ||
<Text variant="highlight">{title}</Text> | ||
<Text variant="hint" color="textSubdued"> | ||
{description} | ||
</Text> | ||
</VStack> | ||
</HStack> | ||
); | ||
}; | ||
export const AnalyticsInfoRow = ({ iconName, title, description }: AnalyticsInfoRowProps) => ( | ||
<IconListItem icon={iconName} iconSize="mediumLarge"> | ||
<VStack spacing="sp4" flex={1}> | ||
<Text variant="highlight">{title}</Text> | ||
<Text variant="hint" color="textSubdued"> | ||
{description} | ||
</Text> | ||
</VStack> | ||
</IconListItem> | ||
); |