Skip to content

Commit

Permalink
Add icon to list shadow views
Browse files Browse the repository at this point in the history
  • Loading branch information
theboi committed Mar 29, 2020
1 parent 501e958 commit 6de1d8e
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 46 deletions.
2 changes: 1 addition & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const App = (props: any) => {
tabBarOptions={{
activeTintColor: themeColor.contrast,
activeBackgroundColor: themeColor.secondaryBG,
inactiveTintColor: 'gray',
inactiveTintColor: `${themeColor.contrast}99`,
inactiveBackgroundColor: themeColor.secondaryBG,
style: {borderTopColor: themeColor.primaryBG},
}}>
Expand Down
56 changes: 56 additions & 0 deletions src/components/Card/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import {ViewStyle, View, Text, Platform, ListRenderItem} from 'react-native';

import {TouchableShadow} from '../../Shadow/Touchable';
import {K} from '../../../store/constants';
import {ViewShadow} from '../../Shadow/View';
import {List, ListItem, Layout} from '@ui-kitten/components';

export const ContentCard = (props: {
theme: string;
data: ReadonlyArray<any> | null | undefined;
style?: ViewStyle;
firstInPage?: boolean;
renderItem?({item, index}): JSX.Element;
backgroundColor?: string;
gradient: boolean;
}) => {
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;

const renderItem = ({item, index}) => {
return (
<ListItem
title={`${item.title}`}
onPress={item.onPress}
style={{height: 50}}
titleStyle={{
...themeFont.subhead,
color: themeColor.primaryText,
marginLeft: 10,
}}
/>
);
};

return (
<ViewShadow
theme={props.theme}
style={{
height: props.data.length * 50,
marginTop: props.firstInPage ? -20 : 0,
marginBottom: 20,
borderRadius: 20,
...Platform.select({
ios: {},
android: {
overflow: 'hidden',
},
}),
}}>
<Layout style={{overflow: 'hidden', borderRadius: 20, height: 100, padding: 8, backgroundColor: props.backgroundColor}}>
<Text>{props.data}</Text>
</Layout>
</ViewShadow>
);
};
46 changes: 42 additions & 4 deletions src/components/Card/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import {TouchableShadow} from '../../Shadow/Touchable';
import {K} from '../../../store/constants';
import {ViewShadow} from '../../Shadow/View';
import {List, ListItem} from '@ui-kitten/components';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { Size } from '@ui-kitten/components/ui/measure/type';

export const ListCard = (props: {
theme: string;
data: ReadonlyArray<any> | null | undefined;
style?: ViewStyle;
firstInPage?: boolean;
renderItem?({ item, index }): JSX.Element;
renderItem?({item, index}): JSX.Element;
}) => {
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
Expand All @@ -22,7 +24,33 @@ export const ListCard = (props: {
title={`${item.title}`}
onPress={item.onPress}
style={{height: 50}}
titleStyle={{...themeFont.subhead, color: themeColor.primaryText, marginLeft: 10}}
titleStyle={{
...themeFont.subhead,
color: themeColor.primaryText,
marginLeft: 10,
}}
icon={
item.icon !== undefined
? () => (
<View
style={{
height: 35,
width: 35,
backgroundColor: item.iconColor,
borderRadius: 5,
}}>
<View
style={{alignItems: 'center'}}>
<Icon
name={item.icon}
size={25}
style={{color: themeColor.white, marginTop: 4}}
/>
</View>
</View>
)
: null
}
/>
);
};
Expand All @@ -39,14 +67,24 @@ export const ListCard = (props: {
ios: {},
android: {
overflow: 'hidden',
}
})
},
}),
}}>
<List
data={props.data}
renderItem={props.renderItem ?? renderItem}
scrollEnabled={false}
style={{overflow: 'hidden', borderRadius: 20}}
ItemSeparatorComponent={() => (
<View
style={{
height: 0.5,
borderBottomColor: 'transparent',
backgroundColor: `${themeColor.contrast}33`,
marginLeft: 50,
}}
/>
)}
/>
</ViewShadow>
);
Expand Down
41 changes: 2 additions & 39 deletions src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {K} from '../../store/constants';
import {PageHeader} from '../../components/Page/PageHeader';
import {ViewShadow} from '../../components/Shadow/View';
import {TextButton} from '../../components/Button/Text';
import {ContentCard} from '../../components/Card/Content';

const HomePageC = (props: any) => {
console.log(props.theme);
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;

Expand All @@ -23,44 +23,7 @@ const HomePageC = (props: any) => {
navigation={props.navigation}
/>
<Layout style={{marginHorizontal: 20}}>
<ViewShadow
theme={props.theme}
style={{marginTop: -20, borderRadius: 20, overflow: 'hidden'}}>
{/* //FIXME: SHADOW NOT SHOWING */}
<Layout
style={{
borderRadius: 20,
overflow: 'hidden',
padding: 20,
backgroundColor: '#E41C1C',
}}>
<Text
style={{
...themeFont.smallTitleE,
color: themeColor.lightText,
marginBottom: 10,
}}>
Add a user to track
</Text>
<Text
style={{
...themeFont.body,
color: themeColor.lightText,
width: 250,
marginBottom: 20,
}}>
Add a user with dementia to keep track of them so that they
would never get lost again!
</Text>
<TextButton
theme={props.theme}
onPress={() =>
props.navigation.navigate('Settings', {screen: 'People'})
}>
Add Now
</TextButton>
</Layout>
</ViewShadow>
<ContentCard theme={props.theme} data={['hello']} backgroundColor={themeColor.red} firstInPage/>
</Layout>
</ScrollView>
</Layout>
Expand Down
12 changes: 12 additions & 0 deletions src/pages/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ const SettingsPageC = (props: any) => {
onPress: () => {
props.navigation.navigate('People');
},
icon: 'account-multiple',
iconColor: themeColor.blue
},
{
title: 'Theme',
onPress: () => {
props.navigation.navigate('Theme');
},
icon: 'invert-colors',
iconColor: themeColor.green
},
{
title: 'Privacy',
Expand All @@ -53,6 +57,8 @@ const SettingsPageC = (props: any) => {
</View>,
]);
},
icon: 'lock',
iconColor: themeColor.indigo
},
];
const list2 = [
Expand Down Expand Up @@ -125,6 +131,8 @@ const SettingsPageC = (props: any) => {
</View>,
]);
},
icon: 'information',
iconColor: themeColor.yellow
},
{
title: 'Tell A Friend',
Expand All @@ -134,6 +142,8 @@ const SettingsPageC = (props: any) => {
<Text style={{color: themeColor.primaryText}}>Share</Text>,
]);
},
icon: 'share',
iconColor: themeColor.teal
},
{
title: 'Report A Bug',
Expand All @@ -143,6 +153,8 @@ const SettingsPageC = (props: any) => {
<Text style={{color: themeColor.primaryText}}>Report</Text>,
]);
},
icon: 'bug',
iconColor: themeColor.red
},
{
title: 'Leave A Review',
Expand Down
24 changes: 22 additions & 2 deletions src/store/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ export const K = {
lightText: '#FFFFFF',
greyText: '#E9E9E9',
contrast: '#000F31',
black: '#000000'
black: '#000000',
white: '#FFFFFF',
red: 'rgb(255, 59, 48)',
orange: 'rgb(255, 149, 0)',
yellow: 'rgb(255, 204, 0)',
green: 'rgb(52, 199, 89)',
teal: 'rgb(90, 200, 250)',
blue: 'rgb(0, 122, 255)',
indigo: 'rgb(88, 86, 214)',
purple: 'rgb(175, 82, 222)',
pink: 'rgb(255, 45, 85)'
},
dark: {
primaryBG: '#232B43',
Expand All @@ -24,7 +34,17 @@ export const K = {
lightText: '#FFFFFF',
greyText: '#E9E9E9',
contrast: '#FFFFFF',
black: '#000000'
black: '#000000',
white: '#FFFFFF',
red: 'rgb(255, 69, 58)',
orange: 'rgb(255, 159, 10)',
yellow: 'rgb(255, 214, 10)',
green: 'rgb(48, 209, 88)',
teal: 'rgb(100, 210, 255)',
blue: 'rgb(10, 132, 255)',
indigo: 'rgb(94, 92, 230)',
purple: 'rgb(191, 90, 242)',
pink: 'rgb(255, 55, 95)'
},
},
fonts: {
Expand Down

0 comments on commit 6de1d8e

Please sign in to comment.