Skip to content

Commit bd406b2

Browse files
committed
ref: routes components to their own files
1 parent 181f531 commit bd406b2

File tree

8 files changed

+91
-69
lines changed

8 files changed

+91
-69
lines changed

Diff for: src/router/utils/components/IsTestnet/IsTestnet.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import {View, Text, StyleSheet} from 'react-native';
3+
import type {VFC} from 'react';
4+
import CONFIG from 'config';
5+
6+
const styles = StyleSheet.create({
7+
container: {
8+
backgroundColor: '#d9534f',
9+
padding: 5,
10+
borderRadius: 5,
11+
marginLeft: 15,
12+
},
13+
text: {
14+
color: 'white',
15+
fontSize: 10,
16+
},
17+
});
18+
19+
export const isTestnet: VFC = () => {
20+
if (!CONFIG.TESTNET) {
21+
return;
22+
}
23+
return (
24+
<View style={styles.container}>
25+
<Text style={styles.text} />
26+
</View>
27+
);
28+
};

Diff for: src/router/utils/components/IsTestnet/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './IsTestnet';

Diff for: src/router/utils/components/SmallLogo/SmallLogo.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import {View, StyleSheet, Image} from 'react-native';
3+
import type {VFC} from 'react';
4+
import {Colors} from 'utils/colors';
5+
import {isTestnet} from '../IsTestnet';
6+
7+
const styles = StyleSheet.create({
8+
container: {
9+
flexDirection: 'row',
10+
justifyContent: 'center',
11+
alignItems: 'center',
12+
},
13+
image: {
14+
height: 280 / 13,
15+
width: 279 / 13,
16+
tintColor: Colors.foreground,
17+
marginLeft: 3,
18+
},
19+
});
20+
21+
export const SmallLogo: VFC = () => {
22+
return (
23+
<View style={styles.container}>
24+
<Image source={require('assets/logo_small.png')} style={styles.image} />
25+
{isTestnet()}
26+
</View>
27+
);
28+
};

Diff for: src/router/utils/components/SmallLogo/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './SmallLogo';

Diff for: src/router/utils/components/TabLogo/TabLogo.tsx

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
import {View, Image, StyleSheet} from 'react-native';
3+
import type {VFC} from 'react';
4+
import {Colors} from 'utils/colors';
5+
6+
const styles = StyleSheet.create({
7+
container: {
8+
flexDirection: 'row',
9+
justifyContent: 'center',
10+
alignItems: 'center',
11+
},
12+
image: inverse => ({
13+
height: 280 / 13,
14+
width: 279 / 13,
15+
tintColor: inverse ? Colors.foreground : Colors.background,
16+
marginLeft: 3,
17+
}),
18+
});
19+
20+
export const TabLogo: VFC = (inverse = false) => {
21+
return (
22+
<View style={styles.container}>
23+
<Image
24+
source={require('assets/logo_small.png')}
25+
style={styles.image(inverse)}
26+
/>
27+
</View>
28+
);
29+
};

Diff for: src/router/utils/components/TabLogo/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './TabLogo';

Diff for: src/router/utils/index.tsx

+2-68
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,10 @@
11
import React from 'react';
22
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
3-
import CONFIG from 'config';
43
import Icon from 'react-native-vector-icons/Ionicons';
5-
import {Image, Platform, View, Text} from 'react-native';
4+
import {Platform} from 'react-native';
65
import {Colors} from 'utils/colors';
76
import {tabs} from './tabs';
8-
9-
export const isTestnet = () => {
10-
if (!CONFIG.TESTNET) {
11-
return;
12-
}
13-
return (
14-
<View
15-
style={{
16-
backgroundColor: '#d9534f',
17-
padding: 5,
18-
borderRadius: 5,
19-
marginLeft: 15,
20-
}}>
21-
<Text
22-
style={{
23-
color: 'white',
24-
fontSize: 10,
25-
}}>
26-
TESTNET
27-
</Text>
28-
</View>
29-
);
30-
};
31-
32-
export const TabLogo = (inverse = false) => {
33-
return (
34-
<View
35-
style={{
36-
flexDirection: 'row',
37-
justifyContent: 'center',
38-
alignItems: 'center',
39-
}}>
40-
<Image
41-
source={require('../../assets/logo_small.png')}
42-
style={{
43-
height: 280 / 13,
44-
width: 279 / 13,
45-
tintColor: inverse ? Colors.foreground : Colors.background,
46-
marginLeft: 3,
47-
}}
48-
/>
49-
</View>
50-
);
51-
};
52-
53-
export const SmallLogo = () => {
54-
return (
55-
<View
56-
style={{
57-
flexDirection: 'row',
58-
justifyContent: 'center',
59-
alignItems: 'center',
60-
}}>
61-
<Image
62-
source={require('../../assets/logo_small.png')}
63-
style={{
64-
height: 280 / 13,
65-
width: 279 / 13,
66-
tintColor: Colors.foreground,
67-
marginLeft: 3,
68-
}}
69-
/>
70-
{isTestnet()}
71-
</View>
72-
);
73-
};
7+
import {TabLogo} from './components/TabLogo/';
748

759
const Tab = createBottomTabNavigator();
7610

Diff for: src/router/utils/tabs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Colors} from 'utils/colors';
2-
import {SmallLogo} from './index';
2+
import {SmallLogo} from './components/SmallLogo';
33
import DashboardScreen from 'screens/Dashboard';
44
import MarketScreen from 'screens/Market';
55
import PortfolioScreen from 'screens/Portfolio';

0 commit comments

Comments
 (0)