diff --git a/vds-app/App/components/Button.js b/vds-app/App/components/Button.js index 5fe22d6..2c4fdad 100644 --- a/vds-app/App/components/Button.js +++ b/vds-app/App/components/Button.js @@ -5,6 +5,8 @@ import { colors } from "../components/Variables" const styles = StyleSheet.create({ button: { backgroundColor: colors.white_alpha, + borderWidth: 4, + borderColor: 'transparent', borderRadius: 10, paddingHorizontal: 10, paddingVertical: 10, @@ -31,20 +33,33 @@ const styles = StyleSheet.create({ } }) -export const Button = ({ text, subtitle = null, isBig = false, onPress = () => {} }) => { +export const Button = ({ text, subtitle = null, isBig = false, colorize = false, onPress = () => {} }) => { const buttonBig = isBig ? {fontSize: 25} : {} + const isClicked = colorize.clicked == colorize.id + let buttonColor = {backgroundColor: colors.white_alpha} + + if(colorize && colorize.answered) { + + if(colorize.isCorrect) { + buttonColor = {backgroundColor: colors.green_light, borderColor: isClicked ? colors.white_alpha : 'transparent'} + } else { + if(isClicked) { + buttonColor = {backgroundColor: colors.red_light, borderColor: isClicked ? colors.white_alpha : 'transparent'} + } + } + } if(subtitle) { return ( - + {text} {subtitle} ) } else { return ( - + {text} ) diff --git a/vds-app/App/components/Variables.js b/vds-app/App/components/Variables.js index d177f29..74e4d56 100644 --- a/vds-app/App/components/Variables.js +++ b/vds-app/App/components/Variables.js @@ -4,19 +4,21 @@ export const colors = { black: "#000", purple: "#8c0072", purple_light: "#a30085", - blue: "#15a7f0", + blue: "#1385d0", dark_blue: "#1279be", red: "#af321e", red_alpha: "rgba(175, 50, 30, 0.9)", + red_light: "#af5d44", green: "#28A125", green_alpha: "rgba(40, 160, 40, 0.9)", + green_light: "#6cc155", yellow: "#e1ff3c", yellow_alpha: "rgba(225, 255, 60, 0.9)", orange: "#ff9b32" } export const texts = { - quizzes: "Seleziona un quiz", + quizzes: "Seleziona un argomento", section_quizzes: "Quiz per argomento", exam: "Simulazione esame", exam_simulation: "30 domande in 30min", diff --git a/vds-app/App/screens/Banner.js b/vds-app/App/screens/Banner.js index 5b5c52d..c7432dd 100644 --- a/vds-app/App/screens/Banner.js +++ b/vds-app/App/screens/Banner.js @@ -38,7 +38,7 @@ class Banner extends React.Component { } bannerError = (e) => { - console.log("Banner error: ", e) + //console.log("Banner error: ", e) } render() { diff --git a/vds-app/App/screens/Exam.js b/vds-app/App/screens/Exam.js index 4aa7998..c177921 100644 --- a/vds-app/App/screens/Exam.js +++ b/vds-app/App/screens/Exam.js @@ -54,10 +54,10 @@ class Exam extends React.Component { timer: maxTime } - answer = correct => { + answer = (correct, id) => { this.setState( state => { - const nextState = { answered: true } + const nextState = { answered: true, clickedId: id } if (correct) { nextState.correctCount = state.correctCount + 1 @@ -71,7 +71,7 @@ class Exam extends React.Component { }, () => { if(this.state.timer > 1 || (this.state.correctCount+this.state.wrongCount) < this.state.totalCount) { - setTimeout(() => this.nextQuestion(), 750) + setTimeout(() => this.nextQuestion(), correct ? 750 : 2000) } } ) @@ -138,7 +138,8 @@ class Exam extends React.Component {