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 React, { useContext } from 'react';
|
||||||
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
|
import { StyleSheet,Pressable, Text, View } from 'react-native';
|
||||||
import Separator from '../components/Separator';
|
|
||||||
|
import ColorContext from '../theme/ColorContext';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface foodElementImageProps {
|
interface foodElementImageProps {
|
||||||
title : string
|
title : string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default function FoodElementText(props : any) {
|
export default function FoodElementText(props : any) {
|
||||||
return (
|
const {colors, toggleColors } = useContext(ColorContext)
|
||||||
<Pressable style={styles.button}>
|
|
||||||
<View style={styles.container}>
|
|
||||||
<View style={styles.view}>
|
|
||||||
<Text style={styles.text}>{props.title}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Pressable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
button: {
|
button: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
width: "80%",
|
width: "80%",
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
backgroundColor: '#E3DEC9',
|
backgroundColor: colors.carrouselBackground,
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
padding : "2%",
|
padding : "2%",
|
||||||
color: 'black',
|
color: colors.cardDetail,
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: '#3F3C42',
|
borderColor: colors.cardDetail,
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
justifyContent: 'center',
|
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 {StyleSheet,Pressable, Text, View, Image} from 'react-native';
|
||||||
|
import ColorContext from '../theme/ColorContext';
|
||||||
|
|
||||||
type Profile = {
|
type Profile = {
|
||||||
name: string
|
name: string
|
||||||
avatar: string
|
avatar: string
|
||||||
isActive: string
|
isActive: string
|
||||||
disableSelection: boolean
|
disableSelection: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ProfileElement(props : Profile) {
|
export default function ProfileElement(props : Profile) {
|
||||||
const [waiting, setWaiting] = useState("none")
|
const { colors, toggleColors } = useContext(ColorContext)
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
let imageSource
|
const [waiting, setWaiting] = useState("none")
|
||||||
if (props.avatar == "plus.png"){
|
const [separator, setSeparator] = useState("none")
|
||||||
imageSource = require('../assets/images/plus.png')
|
const changeStatus = () => {
|
||||||
}
|
if (props.disableSelection){
|
||||||
else if (props.avatar == "plus_small.png"){
|
setWaiting("none")
|
||||||
imageSource = require('../assets/images/plus_small.png')
|
}
|
||||||
}
|
else if (waiting == "flex"){
|
||||||
else{
|
setWaiting("none")
|
||||||
imageSource = require('../assets/images/logo.png')
|
}
|
||||||
}
|
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 (
|
let imageSource
|
||||||
<Pressable onPress={changeStatus} style={styles.button}>
|
if (props.avatar == "plus.png"){
|
||||||
<View>
|
imageSource = require('../assets/images/plus.png')
|
||||||
<View style={styles.pseudoBar}>
|
}
|
||||||
<Image source={imageSource} style={styles.avatar}></Image>
|
else if (props.avatar == "plus_small.png"){
|
||||||
<Text style={styles.text}>{props.name}</Text>
|
imageSource = require('../assets/images/plus_small.png')
|
||||||
</View>
|
}
|
||||||
<View style={styles.pseudoBar}>
|
else{
|
||||||
<View style={[styles.active, {display: props.isActive}]}>
|
imageSource = require('../assets/images/logo.png')
|
||||||
<Text style={styles.textActive}>Activated</Text>
|
}
|
||||||
</View>
|
|
||||||
<View style={{flex: 0.3, display: separator}}/>
|
const styles = StyleSheet.create({
|
||||||
<View style={[styles.waiting, {display: waiting}]}>
|
button: {
|
||||||
<Text style={styles.textWaiting}>Waiting...</Text>
|
alignItems: 'center',
|
||||||
</View>
|
justifyContent: 'flex-start',
|
||||||
</View>
|
height: "80%",
|
||||||
</View>
|
width: "78%",
|
||||||
</Pressable>
|
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({
|
active: {
|
||||||
button: {
|
borderWidth: 1,
|
||||||
alignItems: 'center',
|
borderRadius: 20,
|
||||||
justifyContent: 'flex-start',
|
borderColor: colors.carrouselDetail,
|
||||||
height: "80%",
|
padding: "1%",
|
||||||
width: "78%",
|
},
|
||||||
marginVertical: "3%",
|
textActive: {
|
||||||
},
|
fontSize: 10,
|
||||||
pseudoBar: {
|
color: colors.carrouselDetail,
|
||||||
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: {
|
waiting: {
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderRadius: 20,
|
borderRadius: 20,
|
||||||
borderColor: "#59BDCD",
|
borderColor: "#ACA279",
|
||||||
padding: "1%",
|
padding: "1%",
|
||||||
},
|
},
|
||||||
textActive: {
|
textWaiting: {
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: "#59BDCD",
|
color: "#ACA279",
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
|
||||||
waiting: {
|
return (
|
||||||
borderWidth: 1,
|
<Pressable onPress={changeStatus} style={styles.button}>
|
||||||
borderRadius: 20,
|
<View>
|
||||||
borderColor: "#ACA279",
|
<View style={styles.pseudoBar}>
|
||||||
padding: "1%",
|
<Image source={imageSource} style={styles.avatar}></Image>
|
||||||
},
|
<Text style={styles.text}>{props.name}</Text>
|
||||||
textWaiting: {
|
</View>
|
||||||
fontSize: 10,
|
<View style={styles.pseudoBar}>
|
||||||
color: "#ACA279",
|
<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