-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Convert monolithic component into smaller pieces
- Loading branch information
Showing
4 changed files
with
134 additions
and
241 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react'; | ||
import { View, TouchableOpacity, Image } from 'react-native'; | ||
import { strings } from '../../../../locales/i18n'; | ||
import Text, { | ||
TextColor, | ||
TextVariant, // TextColor, | ||
// TextVariant, | ||
} from '../../../component-library/components/Texts/Text'; | ||
import styleSheet from './NftGrid.styles'; | ||
import { useStyles } from '../../hooks/useStyles'; | ||
import { StackNavigationProp } from '@react-navigation/stack'; | ||
import AppConstants from '../../../core/AppConstants'; | ||
import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletView.selectors'; | ||
|
||
import noNftPlaceholderSrc from '../../../images/no-nfts-placeholder.png'; | ||
interface NftGridNavigationParamList { | ||
AddAsset: { assetType: string }; | ||
[key: string]: undefined | object; | ||
} | ||
|
||
interface NftGridProps { | ||
navigation: StackNavigationProp<NftGridNavigationParamList, 'AddAsset'>; | ||
} | ||
|
||
function NftGridEmpty({ navigation }: NftGridProps) { | ||
const { styles } = useStyles(styleSheet, {}); | ||
|
||
return ( | ||
<View | ||
// eslint-disable-next-line react-native/no-inline-styles | ||
style={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<Image | ||
// eslint-disable-next-line react-native/no-color-literals, react-native/no-inline-styles | ||
style={{ | ||
height: 90, | ||
width: 90, | ||
tintColor: 'lightgray', | ||
marginTop: 30, | ||
marginBottom: 12, | ||
}} | ||
source={noNftPlaceholderSrc} | ||
resizeMode="contain" | ||
/> | ||
<Text | ||
style={styles.headingMd} | ||
variant={TextVariant.HeadingMD} | ||
color={TextColor.Alternative} | ||
> | ||
{strings('wallet.no_nfts_yet')} | ||
</Text> | ||
<TouchableOpacity | ||
onPress={() => | ||
navigation.navigate('Webview', { | ||
screen: 'SimpleWebview', | ||
params: { url: AppConstants.URLS.NFT }, | ||
}) | ||
} | ||
testID={WalletViewSelectorsIDs.IMPORT_NFT_BUTTON} | ||
> | ||
<Text | ||
variant={TextVariant.BodyMDMedium} | ||
color={TextColor.Info} | ||
onPress={() => console.log('goToLearnMore')} | ||
> | ||
{strings('wallet.learn_more')} | ||
</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
} | ||
|
||
export default NftGridEmpty; |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { View, TouchableOpacity } from 'react-native'; | ||
import { strings } from '../../../../locales/i18n'; | ||
import Text, { | ||
TextColor, | ||
TextVariant, | ||
} from '../../../component-library/components/Texts/Text'; // TextVariant, // TextColor, | ||
import { StackNavigationProp } from '@react-navigation/stack'; | ||
import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletView.selectors'; | ||
|
||
interface NftGridNavigationParamList { | ||
AddAsset: { assetType: string }; | ||
[key: string]: undefined | object; | ||
} | ||
|
||
interface NftGridFooterProps { | ||
navigation: StackNavigationProp<NftGridNavigationParamList, 'AddAsset'>; | ||
} | ||
|
||
function NftGridFooter({ navigation }: NftGridFooterProps) { | ||
return ( | ||
<View | ||
// eslint-disable-next-line react-native/no-inline-styles | ||
style={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<Text variant={TextVariant.BodyMDMedium} color={TextColor.Alternative}> | ||
{strings('wallet.no_collectibles')} | ||
</Text> | ||
<TouchableOpacity | ||
onPress={() => | ||
navigation.push('AddAsset', { assetType: 'collectible' }) | ||
} | ||
disabled={false} | ||
testID={WalletViewSelectorsIDs.IMPORT_NFT_BUTTON} | ||
> | ||
<Text variant={TextVariant.BodyMDMedium} color={TextColor.Info}> | ||
{strings('wallet.add_collectibles')} | ||
</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
} | ||
|
||
export default NftGridFooter; |
Oops, something went wrong.