fix: Profile creation page uses color context
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
fb5aacd48a
commit
510aaf525e
@ -1,116 +1,119 @@
|
|||||||
import React from 'react';
|
import React, { useContext, useState } from 'react';
|
||||||
import { useState } from 'react';
|
|
||||||
import {StyleSheet, Text, TextInput, View, Image} from 'react-native';
|
import {StyleSheet, Text, TextInput, View, Image} from 'react-native';
|
||||||
|
|
||||||
import ValidateButton from './ValidateButton';
|
import ValidateButton from './ValidateButton';
|
||||||
import ListSelect from './ListSelect';
|
import ListSelect from './ListSelect';
|
||||||
import ListWithoutSelect from './ListWithoutSelect';
|
import ListWithoutSelect from './ListWithoutSelect';
|
||||||
|
import ColorContext from '../theme/ColorContext';
|
||||||
|
|
||||||
type ProfileProps = {
|
type ProfileProps = {
|
||||||
name: string
|
name: string
|
||||||
avatar: string
|
avatar: string
|
||||||
diets: list<string>
|
diets: string[]
|
||||||
allergies: list<string>
|
allergies: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ProfileModification(props: ProfileProps) {
|
export default function ProfileModification(props: ProfileProps) {
|
||||||
const [name, onChangeName] = useState(props.name);
|
const [name, onChangeName] = useState(props.name);
|
||||||
|
const { colors, toggleColors } = useContext(ColorContext);
|
||||||
|
|
||||||
let imageSource
|
let imageSource
|
||||||
if (props.avatar == "plus.png"){
|
if (props.avatar == "plus.png"){
|
||||||
imageSource = require('../assets/images/plus.png')
|
imageSource = require('../assets/images/plus.png')
|
||||||
}
|
}
|
||||||
else if (props.avatar == "plus_small.png"){
|
else if (props.avatar == "plus_small.png"){
|
||||||
imageSource = require('../assets/images/plus_small.png')
|
imageSource = require('../assets/images/plus_small.png')
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
imageSource = require('../assets/images/logo.png')
|
imageSource = require('../assets/images/logo.png')
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
const styles = StyleSheet.create({
|
||||||
<View style={styles.background}>
|
background: {
|
||||||
<View style={styles.pseudoBar}>
|
flexDirection: 'column',
|
||||||
<Image source={imageSource} style={styles.avatar}></Image>
|
alignItems: 'center',
|
||||||
<TextInput style={styles.textInput} value={name} onChangeText={onChangeName} placeholder="Name"></TextInput>
|
justifyContent: 'center',
|
||||||
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
|
borderRadius: 15,
|
||||||
</View>
|
backgroundColor: colors.cardBackground,
|
||||||
<View style={styles.filterBar}>
|
padding: "3%",
|
||||||
<Text style={styles.filters}>Filters</Text>
|
marginHorizontal: "3%",
|
||||||
<Text style={styles.nbSelected}>3 selected</Text>
|
},
|
||||||
</View>
|
|
||||||
<ListSelect title="Diets" content={props.diets}></ListSelect>
|
|
||||||
<View style={{marginTop: "6%"}}/>
|
|
||||||
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
|
|
||||||
<View style={{marginTop: "3%"}}/>
|
|
||||||
<ValidateButton title="Add Allergy" image="plus.png" colour="#59BDCD" backColour="#E3DEC9"></ValidateButton>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
pseudoBar: {
|
||||||
background: {
|
flexDirection: "row",
|
||||||
flexDirection: 'column',
|
alignItems: "center",
|
||||||
alignItems: 'center',
|
justifyContent: "center",
|
||||||
justifyContent: 'center',
|
width: "100%",
|
||||||
borderRadius: 15,
|
marginHorizontal: "3%",
|
||||||
backgroundColor: '#F2F0E4',
|
marginBottom: "3%",
|
||||||
padding: "3%",
|
},
|
||||||
marginHorizontal: "3%",
|
avatar: {
|
||||||
},
|
padding: "5%",
|
||||||
|
resizeMode: 'contain',
|
||||||
|
borderWidth: 2,
|
||||||
|
borderColor: colors.cardTitle,
|
||||||
|
borderRadius: 45,
|
||||||
|
height: "100%",
|
||||||
|
flex: 0.04,
|
||||||
|
},
|
||||||
|
textInput: {
|
||||||
|
fontSize: 15,
|
||||||
|
color: colors.cardTitle,
|
||||||
|
borderRadius: 10,
|
||||||
|
borderWidth: 2,
|
||||||
|
borderStyle: 'dashed',
|
||||||
|
borderColor: colors.cardTitle,
|
||||||
|
alignItems: 'center',
|
||||||
|
textAlign: 'left',
|
||||||
|
flex: 0.8,
|
||||||
|
marginLeft: "7%",
|
||||||
|
padding: "2%",
|
||||||
|
},
|
||||||
|
modify: {
|
||||||
|
height: "100%",
|
||||||
|
tintColor: colors.cardTitle,
|
||||||
|
resizeMode: 'contain',
|
||||||
|
flex: 0.1,
|
||||||
|
marginLeft: "3%",
|
||||||
|
},
|
||||||
|
|
||||||
pseudoBar: {
|
filterBar: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
width: "85%",
|
||||||
justifyContent: "center",
|
paddingTop: "3%",
|
||||||
width: "100%",
|
paddingBottom: "2%",
|
||||||
marginHorizontal: "3%",
|
alignItems: "flex-end",
|
||||||
marginBottom: "3%",
|
justifyContent: "center",
|
||||||
},
|
},
|
||||||
avatar: {
|
filters: {
|
||||||
padding: "5%",
|
fontSize: 20,
|
||||||
resizeMode: 'contain',
|
color: colors.cardTitle,
|
||||||
borderWidth: 2,
|
flex: 1,
|
||||||
borderColor: "#ACA279",
|
},
|
||||||
borderRadius: 45,
|
nbSelected: {
|
||||||
height: "100%",
|
fontSize: 11,
|
||||||
flex: 0.04,
|
color: colors.cardDetail,
|
||||||
},
|
textAlign: "right",
|
||||||
textInput: {
|
}
|
||||||
fontSize: 15,
|
});
|
||||||
color: '#ACA279',
|
|
||||||
borderRadius: 10,
|
return (
|
||||||
borderWidth: 2,
|
<View style={styles.background}>
|
||||||
borderStyle: 'dashed',
|
<View style={styles.pseudoBar}>
|
||||||
borderColor: '#ACA279',
|
<Image source={imageSource} style={styles.avatar}></Image>
|
||||||
alignItems: 'center',
|
<TextInput style={styles.textInput} value={name} onChangeText={onChangeName} placeholder="Name"></TextInput>
|
||||||
textAlign: 'left',
|
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
|
||||||
flex: 0.8,
|
</View>
|
||||||
marginLeft: "7%",
|
<View style={styles.filterBar}>
|
||||||
padding: "2%",
|
<Text style={styles.filters}>Filters</Text>
|
||||||
},
|
<Text style={styles.nbSelected}>3 selected</Text>
|
||||||
modify: {
|
</View>
|
||||||
height: "100%",
|
<ListSelect title="Diets" content={props.diets}></ListSelect>
|
||||||
tintColor: "#ACA279",
|
<View style={{marginTop: "6%"}}/>
|
||||||
resizeMode: 'contain',
|
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
|
||||||
flex: 0.1,
|
<View style={{marginTop: "3%"}}/>
|
||||||
marginLeft: "3%",
|
<ValidateButton title="Add Allergy" image="plus.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={() => console.log("Create Profile...")}/>
|
||||||
},
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
filterBar: {
|
|
||||||
flexDirection: "row",
|
|
||||||
width: "85%",
|
|
||||||
paddingTop: "3%",
|
|
||||||
paddingBottom: "2%",
|
|
||||||
alignItems: "flex-end",
|
|
||||||
justifyContent: "center",
|
|
||||||
},
|
|
||||||
filters: {
|
|
||||||
fontSize: 20,
|
|
||||||
color: '#ACA279',
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
nbSelected: {
|
|
||||||
fontSize: 11,
|
|
||||||
color: "#3F3C42",
|
|
||||||
textAlign: "right",
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,43 +1,39 @@
|
|||||||
import React from 'react';
|
import React, { useContext } from 'react';
|
||||||
import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native';
|
import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native';
|
||||||
import { LinearGradient } from 'expo-linear-gradient';
|
import { LinearGradient } from 'expo-linear-gradient';
|
||||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||||
|
|
||||||
import ProfileModification from '../components/ProfileModification';
|
import ProfileModification from '../components/ProfileModification';
|
||||||
import ValidateButton from '../components/ValidateButton';
|
import ValidateButton from '../components/ValidateButton';
|
||||||
|
import ColorContext from '../theme/ColorContext';
|
||||||
|
|
||||||
export default function CreateProfile(props) {
|
export default function CreateProfile(props) {
|
||||||
const all = []
|
const { colors, toggleColors } = useContext(ColorContext)
|
||||||
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
|
const all = []
|
||||||
return (
|
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
|
||||||
<SafeAreaProvider style={{flex: 1}}>
|
|
||||||
<ScrollView>
|
const styles = StyleSheet.create({
|
||||||
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
|
linearGradient: {
|
||||||
<View style={{marginTop: "6%"}}/>
|
height: "100%",
|
||||||
<ProfileModification name="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
|
width: "100%",
|
||||||
<View style={{marginTop: "3%"}}/>
|
flex: 1,
|
||||||
<ValidateButton title="Create Profile" image="plus.png" colour="#ACA279" backColour="#F2F0E4" todo={() => (console.log("Profile Created"))}></ValidateButton>
|
padding: "2%",
|
||||||
<View style={{marginTop: "20%"}}/>
|
paddingTop: 0,
|
||||||
</LinearGradient>
|
},
|
||||||
</ScrollView>
|
});
|
||||||
</SafeAreaProvider>
|
|
||||||
);
|
return (
|
||||||
|
<SafeAreaProvider style={{flex: 1}}>
|
||||||
|
<ScrollView>
|
||||||
|
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
|
||||||
|
<View style={{marginTop: "6%"}}/>
|
||||||
|
<ProfileModification name="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
|
||||||
|
<View style={{marginTop: "3%"}}/>
|
||||||
|
<ValidateButton title="Create Profile" image="plus.png" colour={colors.cardTitle} backColour={colors.cardBackground} todo={() => (console.log("Profile Created"))}></ValidateButton>
|
||||||
|
<View style={{marginTop: "20%"}}/>
|
||||||
|
</LinearGradient>
|
||||||
|
</ScrollView>
|
||||||
|
</SafeAreaProvider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
flex: 1,
|
|
||||||
backgroundColor: '#3F3C42',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
linearGradient: {
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
flex: 1,
|
|
||||||
padding: "2%",
|
|
||||||
paddingTop: 0,
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
Reference in new issue