Merge pull request 'part7' (#10) from part7 into master

Reviewed-on: #10
master
Antoine PEREDERII 1 year ago
commit 1c2518a02a

@ -7,14 +7,14 @@ export const greyColor = "rgba(140, 140, 161, 1)";
export const whiteColor = "rgba(239, 239, 253, 1)"; export const whiteColor = "rgba(239, 239, 253, 1)";
export const DefaultTheme: Theme = { export const LightTheme: Theme = {
dark: false, dark: false,
colors: { colors: {
primary: 'rgb(0, 122, 255)', primary: darksalmonColor,
background: "rgba(239, 239, 253, 1)", background: whiteColor,
card: 'rgb(255, 255, 255)', card: greyColor,
text: 'rgb(28, 28, 30)', text: "black",
border: 'rgb(216, 216, 216)', border: whiteColor,
notification: 'rgb(255, 59, 48)', notification: 'rgb(255, 59, 48)',
}, },
}; };
@ -22,11 +22,11 @@ export const DefaultTheme: Theme = {
export const DarkTheme: Theme = { export const DarkTheme: Theme = {
dark: true, dark: true,
colors: { colors: {
primary: 'rgb(10, 132, 255)', primary: darksalmonColor,
background: "rgba(140, 140, 161, 1)", background: purpleColor,
card: 'rgb(18, 18, 18)', card: indigoColor,
text: 'rgb(229, 229, 231)', text: whiteColor,
border: 'rgb(39, 39, 41)', border: greyColor,
notification: 'rgb(255, 69, 58)', notification: 'rgb(255, 69, 58)',
}, },
}; };

@ -8,6 +8,7 @@ import {darksalmonColor, greyColor, indigoColor, purpleColor, whiteColor} from "
import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk"; import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk";
import React, {useEffect} from "react"; import React, {useEffect} from "react";
import {postCustomJoke} from "../redux/thunk/PostThunk"; import {postCustomJoke} from "../redux/thunk/PostThunk";
import {useTheme} from "@react-navigation/native";
export default function AddScreen() { export default function AddScreen() {
// @ts-ignore // @ts-ignore
@ -31,6 +32,8 @@ export default function AddScreen() {
clearFields(); clearFields();
}; };
const styles = themeSettings()
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.text}>Blague</Text> <Text style={styles.text}>Blague</Text>
@ -85,63 +88,68 @@ export default function AddScreen() {
) )
}; };
const styles = StyleSheet.create({
container: {
backgroundColor: purpleColor, export function themeSettings() {
width: "100%", const theme = useTheme();
height: "100%", const colors = theme.colors;
}, const styles = StyleSheet.create({
textInput: { container: {
backgroundColor: indigoColor, backgroundColor: colors.background,
color: whiteColor, width: "100%",
width: "90%", height: "100%",
alignSelf:"center", },
minHeight: 100 textInput: {
}, backgroundColor: colors.card,
eraseButton:{ color: colors.text,
borderRadius : 5, width: "90%",
alignItems: "center", alignSelf: "center",
backgroundColor : whiteColor, minHeight: 100
height:50, },
margin: 10 eraseButton: {
}, borderRadius: 5,
createButton:{ alignItems: "center",
borderRadius : 5, backgroundColor: colors.primary,
alignItems: "center", height: 50,
backgroundColor : darksalmonColor, margin: 10
height:50, },
margin: 10, createButton: {
marginTop: 30 borderRadius: 5,
}, alignItems: "center",
createTextButton : { backgroundColor: colors.primary,
margin: 10, height: 50,
textAlign : "center", margin: 10,
fontWeight: "700", marginTop: 30
color : whiteColor, },
}, createTextButton: {
eraseTextButton : { margin: 10,
margin: 10, textAlign: "center",
textAlign : "center", fontWeight: "700",
fontWeight: "700", color: colors.text,
color : darksalmonColor, },
}, eraseTextButton: {
text: { margin: 10,
color:whiteColor, textAlign: "center",
paddingBottom: 10, fontWeight: "700",
paddingTop: 25, color: colors.text,
marginLeft: 19, },
fontSize: 20, text: {
}, color: colors.text,
textSize: { paddingBottom: 10,
paddingTop: 15, paddingTop: 25,
marginRight: 19, marginLeft: 19,
fontSize: 12, fontSize: 20,
color: whiteColor, },
}, textSize: {
viewCounter: { paddingTop: 15,
alignItems: 'flex-end', marginRight: 19,
bottom: 10, fontSize: 12,
right: 10, color: colors.text,
} },
}) viewCounter: {
alignItems: 'flex-end',
bottom: 10,
right: 10,
}
})
return styles
}

@ -5,6 +5,7 @@ import {darksalmonColor, purpleColor, whiteColor} from "../assets/Theme";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
import React, {useEffect, useState} from "react"; import React, {useEffect, useState} from "react";
import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk"; import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk";
import {useTheme} from "@react-navigation/native";
const eye = require("../assets/eye_icon.png") const eye = require("../assets/eye_icon.png")
const hideEye = require("../assets/eye_off_icon.png") const hideEye = require("../assets/eye_off_icon.png")
@ -39,6 +40,8 @@ export default function Catalogue() {
} }
}, [dispatch, customJokes, sampleJokes]); }, [dispatch, customJokes, sampleJokes]);
const styles = themeSettings()
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<View style={styles.columnContainer}> <View style={styles.columnContainer}>
@ -59,48 +62,53 @@ export default function Catalogue() {
) )
}; };
const styles = StyleSheet.create({ export function themeSettings() {
container: { const theme = useTheme();
backgroundColor: purpleColor, const colors = theme.colors;
flex:1, const styles = StyleSheet.create({
}, container: {
Button:{ backgroundColor: colors.background,
borderRadius : 5, flex: 1,
backgroundColor : darksalmonColor, },
height:40, Button: {
width : 60, borderRadius: 5,
flexDirection : "row" backgroundColor: colors.primary,
}, height: 40,
jokeTypeContainer :{ width: 60,
display : "flex", flexDirection: "row"
flex : 1, },
flexDirection: "row", jokeTypeContainer: {
alignItems : "center" display: "flex",
}, flex: 1,
imageButton : { flexDirection: "row",
margin : 10, alignItems: "center"
width: 40, },
height:30, imageButton: {
top : 5, margin: 10,
alignSelf : "center", width: 40,
backgroundColor: "none", height: 30,
tintColor : whiteColor, top: 5,
justifyContent: "center", alignSelf: "center",
alignItems: "center", backgroundColor: "none",
}, tintColor: colors.notification,
TextButton : { justifyContent: "center",
fontSize: 18, alignItems: "center",
color: whiteColor, },
textAlign: 'center', TextButton: {
fontWeight: 'bold', fontSize: 18,
margin: 10, color: colors.text,
}, textAlign: 'center',
columnContainer: { fontWeight: 'bold',
marginLeft: 20, margin: 10,
marginRight: 20, },
width: '90%', columnContainer: {
flexDirection: "row", marginLeft: 20,
justifyContent: "space-between", marginRight: 20,
alignItems: "center", width: '90%',
} flexDirection: "row",
}); justifyContent: "space-between",
alignItems: "center",
}
});
return styles
}

@ -5,6 +5,7 @@ import {darksalmonColor, purpleColor, whiteColor} from "../assets/Theme";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
import React, {useEffect, useState} from "react"; import React, {useEffect, useState} from "react";
import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk"; import {getCustomJokesList, getSampleJokesList} from "../redux/thunk/GetThunk";
import {useTheme} from "@react-navigation/native";
export default function Favorites() { export default function Favorites() {
// @ts-ignore // @ts-ignore
@ -39,6 +40,8 @@ export default function Favorites() {
} }
}, [dispatch, customJokes, sampleJokes]); }, [dispatch, customJokes, sampleJokes]);
const styles = themeSettings()
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<View style={styles.columnContainer}> <View style={styles.columnContainer}>
@ -59,48 +62,54 @@ export default function Favorites() {
) )
}; };
const styles = StyleSheet.create({
container: { export function themeSettings() {
backgroundColor: purpleColor, const theme = useTheme();
flex:1, const colors = theme.colors;
}, const styles = StyleSheet.create({
Button:{ container: {
borderRadius : 5, backgroundColor: colors.background,
backgroundColor : darksalmonColor, flex: 1,
height:40, },
width : 60, Button: {
flexDirection : "row" borderRadius: 5,
}, backgroundColor: colors.background,
jokeTypeContainer :{ height: 40,
display : "flex", width: 60,
flex : 1, flexDirection: "row"
flexDirection: "row", },
alignItems : "center" jokeTypeContainer: {
}, display: "flex",
imageButton : { flex: 1,
margin : 10, flexDirection: "row",
width: 40, alignItems: "center"
height:30, },
top : 5, imageButton: {
alignSelf : "center", margin: 10,
backgroundColor: "none", width: 40,
tintColor : whiteColor, height: 30,
justifyContent: "center", top: 5,
alignItems: "center", alignSelf: "center",
}, backgroundColor: "none",
TextButton : { tintColor: colors.notification,
fontSize: 18, justifyContent: "center",
color: whiteColor, alignItems: "center",
textAlign: 'center', },
fontWeight: 'bold', TextButton: {
margin: 10, fontSize: 18,
}, color: colors.notification,
columnContainer: { textAlign: 'center',
marginLeft: 20, fontWeight: 'bold',
marginRight: 20, margin: 10,
width: '90%', },
flexDirection: "row", columnContainer: {
justifyContent: "space-between", marginLeft: 20,
alignItems: "center", marginRight: 20,
} width: '90%',
}); flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}
});
return styles
}

@ -6,6 +6,8 @@ import Categs from "../components/Categs";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
import {useEffect} from "react"; import {useEffect} from "react";
import {getCategoriesList, getLastSampleJokesList} from "../redux/thunk/GetThunk"; import {getCategoriesList, getLastSampleJokesList} from "../redux/thunk/GetThunk";
import {useTheme} from "@react-navigation/native";
import styleToBarStyle from "expo-status-bar/build/styleToBarStyle";
export default function Catalogue() { export default function Catalogue() {
// @ts-ignore // @ts-ignore
@ -23,6 +25,9 @@ export default function Catalogue() {
}; };
loadJokes(); loadJokes();
}, [dispatch]); }, [dispatch]);
const styles = themeSettings()
return ( return (
<> <>
<View style={styles.container}> <View style={styles.container}>
@ -48,51 +53,56 @@ export default function Catalogue() {
) )
}; };
const styles = StyleSheet.create({ export function themeSettings() {
container: { const theme = useTheme();
backgroundColor: purpleColor, const colors = theme.colors;
flex:1, const styles = StyleSheet.create({
}, container: {
top: { backgroundColor: colors.background,
alignItems: "center", flex: 1,
}, },
cat: { top: {
height:160, alignItems: "center",
width: 160 },
}, cat: {
textAccueil: { height: 160,
fontSize: 25, width: 160
color: darksalmonColor, },
fontWeight: "bold", textAccueil: {
}, fontSize: 25,
Jokes: { color: colors.text,
display:"flex", fontWeight: "bold",
flexDirection:"column", },
marginTop: 50, Jokes: {
marginLeft: 20, display: "flex",
}, flexDirection: "column",
scrollList: { marginTop: 50,
alignItems: "center" marginLeft: 20,
}, },
textLastJokes: { scrollList: {
color: whiteColor, alignItems: "center"
fontSize: 20, },
fontWeight: "bold", textLastJokes: {
}, color: colors.border,
bestCateg: { fontSize: 20,
marginTop: 30, fontWeight: "bold",
marginLeft: 20, },
}, bestCateg: {
horizBestCateg: { marginTop: 30,
flexDirection: "row", marginLeft: 20,
}, },
textBestCateg: { horizBestCateg: {
color: whiteColor, flexDirection: "row",
fontSize: 20, },
fontWeight: "bold", textBestCateg: {
}, color: colors.text,
horizChip: { fontSize: 20,
flexDirection: "row", fontWeight: "bold",
marginTop: 30, },
} horizChip: {
}); flexDirection: "row",
marginTop: 30,
}
});
return styles
}

@ -8,6 +8,7 @@ import JokeDetail from "../components/JokeDetail";
import {AppDispatch, AppState} from "../redux/store"; import {AppDispatch, AppState} from "../redux/store";
import {CustomJoke} from "../model/CustomJoke"; import {CustomJoke} from "../model/CustomJoke";
import {SampleJoke} from "../model/SampleJoke"; import {SampleJoke} from "../model/SampleJoke";
import {useTheme} from "@react-navigation/native";
export default function JokeDetailsScreen({route}) { export default function JokeDetailsScreen({route}) {
const idJokeDetail = route.params.idJoke; const idJokeDetail = route.params.idJoke;
@ -16,6 +17,8 @@ export default function JokeDetailsScreen({route}) {
const [isCustomJoke, setCustomJoke] = useState(false); const [isCustomJoke, setCustomJoke] = useState(false);
const dispatch = useDispatch<AppDispatch>(); const dispatch = useDispatch<AppDispatch>();
const styles = themeSettings();
useEffect(() => { useEffect(() => {
if(typeof idJokeDetail == 'number') { if(typeof idJokeDetail == 'number') {
const loadJoke = async () => { const loadJoke = async () => {
@ -41,9 +44,15 @@ export default function JokeDetailsScreen({route}) {
) )
}; };
const styles = StyleSheet.create({ export function themeSettings() {
container: { const theme = useTheme();
backgroundColor: purpleColor, const colors = theme.colors;
flex:1,
} const styles = StyleSheet.create({
}); container: {
backgroundColor: colors.background,
flex: 1,
}
});
return styles
}

@ -1,8 +1,11 @@
import '../types/extension'; import '../types/extension';
import {Image, StyleSheet, Switch, Text, View} from "react-native"; import {Image, StyleSheet, Switch, Text, View} from "react-native";
import {darksalmonColor, DefaultTheme, DarkTheme, greyColor, indigoColor, purpleColor, whiteColor} from "../assets/Theme"; import {
import React, {useEffect, useState} from "react"; darksalmonColor,
import {useTheme} from "@react-navigation/native"; whiteColor
} from "../assets/Theme";
import React from "react";
import {DarkTheme, DefaultTheme, useTheme} from "@react-navigation/native";
import {storeTheme} from "../redux/thunk/ThemeThunk"; import {storeTheme} from "../redux/thunk/ThemeThunk";
export default function Catalogue() { export default function Catalogue() {
@ -48,7 +51,7 @@ export function themeSettings() {
const theme = useTheme(); const theme = useTheme();
const colors = theme.colors; const colors = theme.colors;
const styles = StyleSheet.create({ const styles= StyleSheet.create({
container: { container: {
paddingTop: 10, paddingTop: 10,
@ -66,25 +69,25 @@ export function themeSettings() {
title: { title: {
padding: 10, padding: 10,
fontSize: 20, fontSize: 20,
color: whiteColor, color: colors.text,
fontWeight: 'bold' fontWeight: 'bold'
}, },
imageButton : { imageButton : {
width: 30, width: 30,
height:30, height:30,
alignSelf : "center", alignSelf : "center",
tintColor: darksalmonColor, tintColor: colors.primary,
}, },
switchMode: { switchMode: {
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
backgroundColor: indigoColor, backgroundColor: colors.card,
padding: 20, padding: 20,
margin: 10, margin: 10,
}, },
darkModeText: { darkModeText: {
color: whiteColor, color: colors.text,
fontSize: 20, fontSize: 20,
marginLeft: 10, marginLeft: 10,
paddingTop: 5, paddingTop: 5,

Loading…
Cancel
Save