Skip to content

Commit

Permalink
ref: routes components to their own files
Browse files Browse the repository at this point in the history
  • Loading branch information
B3ns44d committed Dec 7, 2021
1 parent 181f531 commit bd406b2
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 69 deletions.
28 changes: 28 additions & 0 deletions src/router/utils/components/IsTestnet/IsTestnet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import {View, Text, StyleSheet} from 'react-native';
import type {VFC} from 'react';
import CONFIG from 'config';

const styles = StyleSheet.create({
container: {
backgroundColor: '#d9534f',
padding: 5,
borderRadius: 5,
marginLeft: 15,
},
text: {
color: 'white',
fontSize: 10,
},
});

export const isTestnet: VFC = () => {
if (!CONFIG.TESTNET) {
return;
}
return (
<View style={styles.container}>
<Text style={styles.text} />
</View>
);
};
1 change: 1 addition & 0 deletions src/router/utils/components/IsTestnet/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './IsTestnet';
28 changes: 28 additions & 0 deletions src/router/utils/components/SmallLogo/SmallLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import {View, StyleSheet, Image} from 'react-native';
import type {VFC} from 'react';
import {Colors} from 'utils/colors';
import {isTestnet} from '../IsTestnet';

const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
image: {
height: 280 / 13,
width: 279 / 13,
tintColor: Colors.foreground,
marginLeft: 3,
},
});

export const SmallLogo: VFC = () => {
return (
<View style={styles.container}>
<Image source={require('assets/logo_small.png')} style={styles.image} />
{isTestnet()}
</View>
);
};
1 change: 1 addition & 0 deletions src/router/utils/components/SmallLogo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './SmallLogo';
29 changes: 29 additions & 0 deletions src/router/utils/components/TabLogo/TabLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import {View, Image, StyleSheet} from 'react-native';
import type {VFC} from 'react';
import {Colors} from 'utils/colors';

const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
image: inverse => ({
height: 280 / 13,
width: 279 / 13,
tintColor: inverse ? Colors.foreground : Colors.background,
marginLeft: 3,
}),
});

export const TabLogo: VFC = (inverse = false) => {
return (
<View style={styles.container}>
<Image
source={require('assets/logo_small.png')}
style={styles.image(inverse)}
/>
</View>
);
};
1 change: 1 addition & 0 deletions src/router/utils/components/TabLogo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './TabLogo';
70 changes: 2 additions & 68 deletions src/router/utils/index.tsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,10 @@
import React from 'react';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import CONFIG from 'config';
import Icon from 'react-native-vector-icons/Ionicons';
import {Image, Platform, View, Text} from 'react-native';
import {Platform} from 'react-native';
import {Colors} from 'utils/colors';
import {tabs} from './tabs';

export const isTestnet = () => {
if (!CONFIG.TESTNET) {
return;
}
return (
<View
style={{
backgroundColor: '#d9534f',
padding: 5,
borderRadius: 5,
marginLeft: 15,
}}>
<Text
style={{
color: 'white',
fontSize: 10,
}}>
TESTNET
</Text>
</View>
);
};

export const TabLogo = (inverse = false) => {
return (
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}>
<Image
source={require('../../assets/logo_small.png')}
style={{
height: 280 / 13,
width: 279 / 13,
tintColor: inverse ? Colors.foreground : Colors.background,
marginLeft: 3,
}}
/>
</View>
);
};

export const SmallLogo = () => {
return (
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}>
<Image
source={require('../../assets/logo_small.png')}
style={{
height: 280 / 13,
width: 279 / 13,
tintColor: Colors.foreground,
marginLeft: 3,
}}
/>
{isTestnet()}
</View>
);
};
import {TabLogo} from './components/TabLogo/';

const Tab = createBottomTabNavigator();

Expand Down
2 changes: 1 addition & 1 deletion src/router/utils/tabs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Colors} from 'utils/colors';
import {SmallLogo} from './index';
import {SmallLogo} from './components/SmallLogo';
import DashboardScreen from 'screens/Dashboard';
import MarketScreen from 'screens/Market';
import PortfolioScreen from 'screens/Portfolio';
Expand Down

0 comments on commit bd406b2

Please sign in to comment.