fix: home page is now using colorContext
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
bd54ec2fa1
commit
1ab6ce5f9d
@ -1,50 +1,52 @@
|
||||
import React from 'react';
|
||||
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
|
||||
import Separator from '../components/Separator';
|
||||
import React, { useContext } from 'react';
|
||||
import { StyleSheet,Pressable, Text, View } from 'react-native';
|
||||
|
||||
import ColorContext from '../theme/ColorContext';
|
||||
|
||||
|
||||
|
||||
interface foodElementImageProps {
|
||||
title : string
|
||||
title : string
|
||||
}
|
||||
|
||||
|
||||
export default function FoodElementText(props : any) {
|
||||
return (
|
||||
<Pressable style={styles.button}>
|
||||
<View style={styles.container}>
|
||||
<View style={styles.view}>
|
||||
<Text style={styles.text}>{props.title}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
const {colors, toggleColors } = useContext(ColorContext)
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: "80%",
|
||||
borderRadius: 5,
|
||||
backgroundColor: '#E3DEC9',
|
||||
},
|
||||
text: {
|
||||
fontSize: 10,
|
||||
fontWeight: 'bold',
|
||||
padding : "2%",
|
||||
color: 'black',
|
||||
},
|
||||
view: {
|
||||
alignItems: 'flex-start',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
container: {
|
||||
width: "100%",
|
||||
borderRadius: 5,
|
||||
borderWidth: 1,
|
||||
borderColor: '#3F3C42',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: "80%",
|
||||
borderRadius: 5,
|
||||
backgroundColor: colors.carrouselBackground,
|
||||
},
|
||||
text: {
|
||||
fontSize: 10,
|
||||
fontWeight: 'bold',
|
||||
padding : "2%",
|
||||
color: colors.cardDetail,
|
||||
},
|
||||
view: {
|
||||
alignItems: 'flex-start',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
container: {
|
||||
width: "100%",
|
||||
borderRadius: 5,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.cardDetail,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Pressable style={styles.button}>
|
||||
<View style={styles.container}>
|
||||
<View style={styles.view}>
|
||||
<Text style={styles.text}>{props.title}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
@ -1,124 +1,127 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useContext, useState } from 'react';
|
||||
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
|
||||
import ColorContext from '../theme/ColorContext';
|
||||
|
||||
type Profile = {
|
||||
name: string
|
||||
avatar: string
|
||||
isActive: string
|
||||
disableSelection: boolean
|
||||
name: string
|
||||
avatar: string
|
||||
isActive: string
|
||||
disableSelection: boolean
|
||||
}
|
||||
|
||||
export default function ProfileElement(props : Profile) {
|
||||
const [waiting, setWaiting] = useState("none")
|
||||
const [separator, setSeparator] = useState("none")
|
||||
const changeStatus = () => {
|
||||
if (props.disableSelection){
|
||||
setWaiting("none")
|
||||
}
|
||||
else if (waiting == "flex"){
|
||||
setWaiting("none")
|
||||
}
|
||||
else{
|
||||
setWaiting("flex")
|
||||
}
|
||||
if (props.disableSelection){
|
||||
setSeparator("none")
|
||||
}
|
||||
else if (props.isActive == "flex" && waiting == "none"){
|
||||
setSeparator("flex")
|
||||
}
|
||||
else{
|
||||
setSeparator("none")
|
||||
}
|
||||
console.log(waiting, separator, props.name)
|
||||
}
|
||||
const { colors, toggleColors } = useContext(ColorContext)
|
||||
|
||||
let imageSource
|
||||
if (props.avatar == "plus.png"){
|
||||
imageSource = require('../assets/images/plus.png')
|
||||
}
|
||||
else if (props.avatar == "plus_small.png"){
|
||||
imageSource = require('../assets/images/plus_small.png')
|
||||
}
|
||||
else{
|
||||
imageSource = require('../assets/images/logo.png')
|
||||
}
|
||||
const [waiting, setWaiting] = useState("none")
|
||||
const [separator, setSeparator] = useState("none")
|
||||
const changeStatus = () => {
|
||||
if (props.disableSelection){
|
||||
setWaiting("none")
|
||||
}
|
||||
else if (waiting == "flex"){
|
||||
setWaiting("none")
|
||||
}
|
||||
else{
|
||||
setWaiting("flex")
|
||||
}
|
||||
if (props.disableSelection){
|
||||
setSeparator("none")
|
||||
}
|
||||
else if (props.isActive == "flex" && waiting == "none"){
|
||||
setSeparator("flex")
|
||||
}
|
||||
else{
|
||||
setSeparator("none")
|
||||
}
|
||||
console.log(waiting, separator, props.name)
|
||||
}
|
||||
|
||||
return (
|
||||
<Pressable onPress={changeStatus} style={styles.button}>
|
||||
<View>
|
||||
<View style={styles.pseudoBar}>
|
||||
<Image source={imageSource} style={styles.avatar}></Image>
|
||||
<Text style={styles.text}>{props.name}</Text>
|
||||
</View>
|
||||
<View style={styles.pseudoBar}>
|
||||
<View style={[styles.active, {display: props.isActive}]}>
|
||||
<Text style={styles.textActive}>Activated</Text>
|
||||
</View>
|
||||
<View style={{flex: 0.3, display: separator}}/>
|
||||
<View style={[styles.waiting, {display: waiting}]}>
|
||||
<Text style={styles.textWaiting}>Waiting...</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
let imageSource
|
||||
if (props.avatar == "plus.png"){
|
||||
imageSource = require('../assets/images/plus.png')
|
||||
}
|
||||
else if (props.avatar == "plus_small.png"){
|
||||
imageSource = require('../assets/images/plus_small.png')
|
||||
}
|
||||
else{
|
||||
imageSource = require('../assets/images/logo.png')
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
height: "80%",
|
||||
width: "78%",
|
||||
marginVertical: "3%",
|
||||
},
|
||||
pseudoBar: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
marginHorizontal: "3%",
|
||||
marginBottom: "3%",
|
||||
},
|
||||
avatar: {
|
||||
padding: "5%",
|
||||
resizeMode: 'contain',
|
||||
borderWidth: 2,
|
||||
borderColor: colors.carrouselText,
|
||||
borderRadius: 45,
|
||||
height: "100%",
|
||||
flex: 0.01,
|
||||
},
|
||||
text: {
|
||||
fontSize: 15,
|
||||
color: colors.carrouselText,
|
||||
alignItems: 'center',
|
||||
textAlign: 'left',
|
||||
flex: 0.9,
|
||||
marginLeft: "10%",
|
||||
padding: "2%",
|
||||
},
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
height: "80%",
|
||||
width: "78%",
|
||||
marginVertical: "3%",
|
||||
},
|
||||
pseudoBar: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
marginHorizontal: "3%",
|
||||
marginBottom: "3%",
|
||||
},
|
||||
avatar: {
|
||||
padding: "5%",
|
||||
resizeMode: 'contain',
|
||||
borderWidth: 2,
|
||||
borderColor: "#ACA279",
|
||||
borderRadius: 45,
|
||||
height: "100%",
|
||||
flex: 0.01,
|
||||
},
|
||||
text: {
|
||||
fontSize: 15,
|
||||
color: '#ACA279',
|
||||
alignItems: 'center',
|
||||
textAlign: 'left',
|
||||
flex: 0.9,
|
||||
marginLeft: "10%",
|
||||
padding: "2%",
|
||||
},
|
||||
active: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 20,
|
||||
borderColor: colors.carrouselDetail,
|
||||
padding: "1%",
|
||||
},
|
||||
textActive: {
|
||||
fontSize: 10,
|
||||
color: colors.carrouselDetail,
|
||||
},
|
||||
|
||||
active: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 20,
|
||||
borderColor: "#59BDCD",
|
||||
padding: "1%",
|
||||
},
|
||||
textActive: {
|
||||
fontSize: 10,
|
||||
color: "#59BDCD",
|
||||
},
|
||||
waiting: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 20,
|
||||
borderColor: "#ACA279",
|
||||
padding: "1%",
|
||||
},
|
||||
textWaiting: {
|
||||
fontSize: 10,
|
||||
color: "#ACA279",
|
||||
},
|
||||
});
|
||||
|
||||
waiting: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 20,
|
||||
borderColor: "#ACA279",
|
||||
padding: "1%",
|
||||
},
|
||||
textWaiting: {
|
||||
fontSize: 10,
|
||||
color: "#ACA279",
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Pressable onPress={changeStatus} style={styles.button}>
|
||||
<View>
|
||||
<View style={styles.pseudoBar}>
|
||||
<Image source={imageSource} style={styles.avatar}></Image>
|
||||
<Text style={styles.text}>{props.name}</Text>
|
||||
</View>
|
||||
<View style={styles.pseudoBar}>
|
||||
<View style={[styles.active, {display: props.isActive}]}>
|
||||
<Text style={styles.textActive}>Activated</Text>
|
||||
</View>
|
||||
<View style={{flex: 0.3, display: separator}}/>
|
||||
<View style={[styles.waiting, {display: waiting}]}>
|
||||
<Text style={styles.textWaiting}>Waiting...</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
Loading…
Reference in new issue