improve design

This commit is contained in:
thewisefarmerr
2019-11-17 16:02:19 +05:00
parent 8e0efddede
commit 3d7285f369
10 changed files with 344 additions and 334 deletions

View File

@@ -1,12 +1,21 @@
import React,{useState} from 'react'; import React, {useState, useEffect} from 'react';
import NavigationService, {AppContainer} from "./src/services/NavigationService" import NavigationService, {
AppContainer,
} from './src/services/NavigationService';
import {StatusBar} from 'react-native';
const App = () => { const App = () => {
return (<AppContainer useEffect(() => {
ref={navigatorRef => { StatusBar.setBackgroundColor('transparent');
NavigationService.setTopLevelNavigator(navigatorRef); StatusBar.setTranslucent(true);
}} StatusBar.setBarStyle('dark-content');
/> });
return (
<AppContainer
ref={navigatorRef => {
NavigationService.setTopLevelNavigator(navigatorRef);
}}
/>
); );
}; };

View File

@@ -0,0 +1,90 @@
import React, {useState} from 'react';
import {
View,
Text,
TouchableOpacity,
ScrollView,
Dimensions,
FlatList,
} from 'react-native';
import {
COLOR_SCHEME,
SIZE,
br,
ph,
pv,
opacity,
FONT,
WEIGHT,
} from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../Reminder';
import {getElevation} from '../../utils/utils';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
const NoteItem = props => {
const [colors, setColors] = useState(COLOR_SCHEME);
const item = props.item;
return (
<View
activeOpacity={opacity}
style={{
marginHorizontal: w * 0.05,
backgroundColor: '#f0f0f0',
marginVertical: h * 0.015,
borderRadius: br,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
padding: pv,
}}>
<View
style={{
width: '92%',
justifyContent: 'center',
alignItems: 'flex-start',
}}>
<Text
style={{
fontSize: SIZE.md,
fontFamily: WEIGHT.bold,
}}>
{item.title}
</Text>
<Text
style={{
fontSize: SIZE.xs + 1,
color: colors.icon,
fontFamily: WEIGHT.regular,
}}>
{item.headline}
</Text>
<Text
style={{
color: colors.accent,
fontSize: SIZE.xxs,
textAlignVertical: 'center',
fontFamily: WEIGHT.regular,
}}>
{item.timestamp + ' '}
</Text>
</View>
<TouchableOpacity
style={{
width: '8%',
justifyContent: 'center',
alignItems: 'center',
minHeight: 60,
}}>
<Icon name="md-more" size={SIZE.xl} color={colors.accent} />
</TouchableOpacity>
</View>
);
};
export default NoteItem;

View File

@@ -1,5 +1,12 @@
import React, {useState} from 'react'; import React, {useState} from 'react';
import {View, Text, TouchableOpacity} from 'react-native'; import {
View,
Text,
TouchableOpacity,
ScrollView,
Dimensions,
FlatList,
} from 'react-native';
import { import {
COLOR_SCHEME, COLOR_SCHEME,
@@ -13,104 +20,150 @@ import {
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {FlatList} from 'react-native-gesture-handler'; import {Reminder} from '../Reminder';
import {getElevation} from '../../utils/utils';
import NoteItem from '../NoteItem';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
// example data
const data = [
{
title: 'One day about',
headline:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has',
timestamp: '2 hours ago',
type: 'note',
},
{
title: 'Shopping List',
headline:
'It is a long established fact that a reader will be distracted by the readable content of',
timestamp: '5 hours ago',
type: 'list',
},
{
title: 'Reminder',
headline:
'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a ',
timestamp: '2 days ago',
type: 'reminder',
},
{
title: 'Writing Notes for',
headline:
'There are many variations of passages of Lorem Ipsum available, but the majority have ',
timestamp: '2 months ago',
},
];
export const RecentList = () => { export const RecentList = () => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
let blockdata = [
{
name: '',
icon: 'md-add',
func: () => {
NavigationService.navigate('Editor');
},
},
{
name: 'Reminders',
icon: 'ios-clock',
func: () => {},
},
{
name: 'Lists',
icon: 'ios-list',
func: () => {},
},
];
return ( return (
<> <>
<FlatList <FlatList
data={[ data={data}
{ ListFooterComponent={
title: 'One day about', <View
headline:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has',
timestamp: '2 hours ago',
type: 'note',
},
{
title: 'Shopping List',
headline:
'It is a long established fact that a reader will be distracted by the readable content of',
timestamp: '5 hours ago',
type: 'list',
},
{
title: 'Reminder',
headline:
'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a ',
timestamp: '2 days ago',
type: 'reminder',
},
{
title: 'Writing Notes for',
headline:
'There are many variations of passages of Lorem Ipsum available, but the majority have ',
timestamp: '2 months ago',
},
]}
renderItem={({item, index}) => (
<TouchableOpacity
activeOpacity={opacity}
style={{ style={{
marginHorizontal: '5%', height: 150,
backgroundColor: '#f0f0f0', alignItems: 'center',
marginVertical: '2.5%', justifyContent: 'center',
borderRadius: br,
paddingVertical: pv - 5,
}}> }}>
<Text <Text
style={{ style={{
fontSize: SIZE.md, color: colors.navbg,
paddingHorizontal: ph, fontSize: SIZE.sm,
paddingTop: pv,
fontFamily: WEIGHT.bold,
}}>
{item.title}
</Text>
<Text
style={{
fontSize: SIZE.xs + 1,
paddingHorizontal: ph,
color: colors.icon,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
}}> }}>
{item.headline} - End -
</Text> </Text>
</View>
<View }
ListHeaderComponent={
<>
<ScrollView
horizontal={true}
style={{ style={{
height: 30, paddingHorizontal: '4%',
width: '100%', }}
borderRadius: 5, showsHorizontalScrollIndicator={false}
justifyContent: 'space-between', contentContainerStyle={{
flexDirection: 'row', justifyContent: 'flex-start',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: ph, flexDirection: 'row',
}}> }}>
<Text {blockdata.map(item => (
style={{ <TouchableOpacity
color: colors.accent, onPress={item.func}
fontSize: SIZE.xxs, activeOpacity={opacity}
textAlignVertical: 'center', style={{
fontFamily: WEIGHT.regular, ...getElevation(5),
}}> width: 100,
{item.timestamp + ' '} height: 100,
</Text> borderRadius: br,
backgroundColor:
item.icon === 'md-add' ? colors.accent : '#f0f0f0',
justifyContent: 'center',
alignItems: 'center',
marginRight: 30,
marginLeft: 5,
marginVertical: 20,
marginBottom: 30,
}}>
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<Icon
name={item.icon}
color={item.icon === 'md-add' ? 'white' : colors.icon}
size={SIZE.xxl}
/>
{item.name !== '' ? (
<Text
style={{
fontSize: SIZE.sm - 2,
color: colors.icon,
fontFamily: WEIGHT.regular,
}}>
{item.name}
</Text>
) : (
undefined
)}
</View>
</TouchableOpacity>
))}
</ScrollView>
<View <Reminder />
style={{ </>
justifyContent: 'space-between', }
flexDirection: 'row', renderItem={({item, index}) => <NoteItem item={item} index={index} />}
alignItems: 'center',
width: '15%',
}}>
<Icon name="ios-share" color={colors.accent} size={SIZE.lg} />
<Icon name="ios-trash" color={colors.accent} size={SIZE.lg} />
</View>
</View>
</TouchableOpacity>
)}
/> />
</> </>
); );

View File

@@ -23,73 +23,72 @@ export const Reminder = () => {
style={{ style={{
...getElevation(10), ...getElevation(10),
width: '90%', width: '90%',
marginVertical: Platform.OS === 'ios' ? h * 0.02 : '5%', marginVertical: Platform.OS === 'ios' ? h * 0.01 : '0%',
alignSelf: 'center', alignSelf: 'center',
borderRadius: br, borderRadius: br,
backgroundColor: colors.accent, backgroundColor: colors.accent,
paddingHorizontal: ph, paddingHorizontal: ph,
paddingVertical: 5, marginBottom: 20,
padding: 5,
}}> }}>
<View <View>
style={{
justifyContent: 'space-between',
flexDirection: 'row',
alignItems: 'center',
}}>
<Icon
style={{
position: 'absolute',
top: 0,
right: 0,
}}
name="ios-clock"
color="white"
size={SIZE.md}
/>
<Text <Text
numberOfLines={1}
style={{ style={{
paddingBottom: 5, width: '100%',
maxWidth: '100%',
}}> }}>
<Text <Text
numberOfLines={1}
style={{ style={{
color: 'white', color: 'white',
fontSize: SIZE.lg, fontSize: SIZE.lg,
fontFamily: WEIGHT.bold, fontFamily: WEIGHT.bold,
maxWidth: '100%',
}}> }}>
Pay Utility Bills Pay Utility Bills
</Text> </Text>
</Text>
<View
style={{
width: '100%',
justifyContent: 'space-between',
flexDirection: 'row',
alignItems: 'flex-end',
}}>
<Text <Text
style={{ style={{
fontFamily: WEIGHT.light, fontFamily: WEIGHT.regular,
fontSize: SIZE.xs, fontSize: SIZE.xs,
color: 'white', color: 'white',
marginBottom: 3,
}}> }}>
{'\n'} {'\n'}
Amount 5000 RS Amount 5000 RS
</Text> </Text>
</Text>
<Text
style={{
color: 'white',
fontSize: SIZE.xxl,
fontFamily: WEIGHT.light,
}}>
<Text <Text
style={{ style={{
fontSize: SIZE.xs, color: 'white',
fontSize: SIZE.xxl,
fontFamily: WEIGHT.light,
}}> }}>
in <Text
style={{
fontSize: SIZE.xs,
}}>
in
</Text>
00:00{''}
<Text
style={{
fontSize: SIZE.xs,
}}>
mins
</Text>
</Text> </Text>
00:00{''} </View>
<Text
style={{
fontSize: SIZE.xs,
}}>
mins
</Text>
</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
); );

View File

@@ -27,9 +27,8 @@ export const Search = () => {
alignSelf: 'center', alignSelf: 'center',
borderRadius: br, borderRadius: br,
paddingHorizontal: ph, paddingHorizontal: ph,
paddingVertical: Platform.OS == 'ios' ? pv : pv - 5, paddingVertical: Platform.OS == 'ios' ? pv - 3 : pv - 8,
marginTop: 10, marginBottom: 10,
marginBottom: 25,
}}> }}>
<TextInput <TextInput
style={{ style={{

View File

View File

@@ -28,6 +28,7 @@ import {Search} from '../../components/SearchInput';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {RecentList} from '../../components/Recents'; import {RecentList} from '../../components/Recents';
import {getElevation} from '../../utils/utils'; import {getElevation} from '../../utils/utils';
import {FlatList} from 'react-native-gesture-handler';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
@@ -35,12 +36,24 @@ export const Home = ({navigation}) => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const RenderMenu = ( const RenderSideMenu = (
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.accent, justifyContent: 'center',
}}> }}>
<View
style={{
backgroundColor: colors.accent,
height: h * 0.5,
width: h * 0.5,
position: 'absolute',
top: h * -0.15,
left: h * -0.2,
transform: [{rotateZ: '340deg'}],
borderRadius: 100,
}}
/>
<View <View
style={{ style={{
height: '25%', height: '25%',
@@ -74,14 +87,13 @@ export const Home = ({navigation}) => {
fontSize: SIZE.xs, fontSize: SIZE.xs,
marginTop: 10, marginTop: 10,
}}> }}>
Usage: 80.45/100 MB 80.45/100 MB
</Text> </Text>
<View <View
style={{ style={{
borderRadius: 2.5, borderRadius: 2.5,
backgroundColor: 'white', backgroundColor: 'white',
...getElevation(10),
marginTop: 10, marginTop: 10,
paddingHorizontal: 5, paddingHorizontal: 5,
paddingVertical: 2, paddingVertical: 2,
@@ -89,8 +101,8 @@ export const Home = ({navigation}) => {
<Text <Text
style={{ style={{
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
fontSize: SIZE.xxs, fontSize: SIZE.xxs,
color: colors.accent,
}}> }}>
Basic User Basic User
</Text> </Text>
@@ -99,133 +111,57 @@ export const Home = ({navigation}) => {
<View <View
style={{ style={{
...getElevation(5), backgroundColor: colors.navbg,
backgroundColor: 'white',
width: '90%', width: '90%',
alignSelf: 'center', alignSelf: 'center',
height: '60%', height: '60%',
marginVertical: 10, marginVertical: 10,
borderRadius: 5, borderRadius: 5,
}}> }}>
<View <FlatList
style={{ data={[
backgroundColor: 'white', {
width: '100%', name: 'Home',
alignSelf: 'center', icon: 'ios-home',
flexDirection: 'row', },
justifyContent: 'flex-start', ]}
alignItems: 'center', keyExtractor={(item, index) => item.name}
paddingHorizontal: ph, renderItem={({item, index}) => (
marginVertical: 10, <TouchableOpacity
}}> activeOpacity={opacity}
<Icon style={{
style={{ width: '100%',
width: 30, alignSelf: 'center',
}} flexDirection: 'row',
name="ios-home" justifyContent: 'flex-start',
color={colors.icon} alignItems: 'center',
size={SIZE.lg} paddingHorizontal: ph,
/> marginVertical: 10,
<Text }}>
style={{ <Icon
fontFamily: WEIGHT.medium, style={{
fontSize: SIZE.sm, width: 30,
marginTop: -5, }}
}}> name={item.icon}
Home color={colors.icon}
</Text> size={SIZE.lg}
</View> />
<View <Text
style={{ style={{
backgroundColor: 'white', fontFamily: WEIGHT.medium,
width: '100%', fontSize: SIZE.sm,
alignSelf: 'center', marginTop: -5,
flexDirection: 'row', }}>
justifyContent: 'flex-start', {item.name}
alignItems: 'center', </Text>
paddingHorizontal: ph, </TouchableOpacity>
marginVertical: 10, )}
}}> />
<Icon
style={{
width: 30,
}}
name="ios-heart"
color={colors.icon}
size={SIZE.lg}
/>
<Text
style={{
fontFamily: WEIGHT.medium,
fontSize: SIZE.sm,
marginTop: -5,
}}>
Favourites
</Text>
</View>
<View
style={{
backgroundColor: 'white',
width: '100%',
alignSelf: 'center',
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
paddingHorizontal: ph,
marginVertical: 10,
}}>
<Icon
style={{
width: 30,
}}
name="ios-settings"
color={colors.icon}
size={SIZE.lg}
/>
<Text
style={{
fontFamily: WEIGHT.medium,
fontSize: SIZE.sm,
marginTop: -5,
}}>
Settings
</Text>
</View>
<View
style={{
backgroundColor: 'white',
width: '100%',
alignSelf: 'center',
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
paddingHorizontal: ph,
marginVertical: 10,
}}>
<Icon
style={{
width: 30,
}}
name="ios-sync"
color={colors.icon}
size={SIZE.lg}
/>
<Text
style={{
fontFamily: WEIGHT.medium,
fontSize: SIZE.sm,
marginTop: -5,
}}>
Sync
</Text>
</View>
</View> </View>
<View <View
style={{ style={{
...getElevation(5),
backgroundColor: '#F3A712', backgroundColor: '#F3A712',
width: '90%', width: '90%',
alignSelf: 'center', alignSelf: 'center',
borderRadius: 5, borderRadius: 5,
@@ -258,26 +194,6 @@ export const Home = ({navigation}) => {
</SafeAreaView> </SafeAreaView>
); );
let data = [
{
name: '',
icon: 'md-add',
func: () => {
NavigationService.navigate('Editor');
},
},
{
name: 'Reminders',
icon: 'ios-clock',
func: () => {},
},
{
name: 'Lists',
icon: 'ios-list',
func: () => {},
},
];
useEffect(() => { useEffect(() => {
setTimeout(() => { setTimeout(() => {
setLoading(false); setLoading(false);
@@ -285,7 +201,10 @@ export const Home = ({navigation}) => {
}); });
return ( return (
<SideMenu menu={RenderMenu} openMenuOffset={w / 1.5}> <SideMenu
bounceBackOnOverdraw={false}
menu={RenderSideMenu}
openMenuOffset={w / 1.5}>
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<View <View
style={{ style={{
@@ -293,8 +212,8 @@ export const Home = ({navigation}) => {
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: '5%', paddingHorizontal: '5%',
marginTop: Platform.OS == 'ios' ? h * 0.02 : '7.5%', marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,
marginBottom: h * 0.02, marginBottom: h * 0.04,
}}> }}>
<Text <Text
style={{ style={{
@@ -304,69 +223,10 @@ export const Home = ({navigation}) => {
}}> }}>
Notes Notes
</Text> </Text>
<Icon name="md-more" color={colors.icon} size={SIZE.xxxl} /> <Icon name="md-more" color={colors.icon} size={SIZE.xxl} />
</View> </View>
<Search /> <Search />
<ScrollView
horizontal={true}
style={{
paddingHorizontal: '4%',
height: 200,
}}
showsHorizontalScrollIndicator={false}
contentContainerStyle={{
justifyContent: 'flex-start',
alignItems: 'center',
flexDirection: 'row',
}}>
{data.map(item => (
<TouchableOpacity
onPress={item.func}
activeOpacity={opacity}
style={{
...getElevation(5),
width: 100,
height: 100,
borderRadius: br,
backgroundColor:
item.icon === 'md-add' ? colors.accent : '#f0f0f0',
justifyContent: 'center',
alignItems: 'center',
marginRight: 30,
marginLeft: 5,
}}>
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<Icon
name={item.icon}
color={item.icon === 'md-add' ? 'white' : colors.icon}
size={SIZE.xxl}
/>
{item.name !== '' ? (
<Text
style={{
fontSize: SIZE.sm - 2,
color: colors.icon,
fontFamily: WEIGHT.regular,
}}>
{item.name}
</Text>
) : (
undefined
)}
</View>
</TouchableOpacity>
))}
</ScrollView>
<Reminder />
<RecentList /> <RecentList />
</SafeAreaView> </SafeAreaView>
</SideMenu> </SideMenu>

View File

View File