File size: 1,450 Bytes
0bedb61 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { COLORS } from '../constants/colors';
interface MathProblemProps {
num1: number;
num2: number;
operator: string;
}
export const MathProblem: React.FC<MathProblemProps> = ({ num1, num2, operator }) => {
return (
<View style={styles.container}>
<Text style={styles.text}>
<Text style={styles.number}>{num1}</Text>
<Text style={styles.operator}> {operator} </Text>
<Text style={styles.number}>{num2}</Text>
<Text style={styles.equals}> = </Text>
<Text style={styles.questionMark}>?</Text>
</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: COLORS.surface,
borderRadius: 16,
borderWidth: 1,
borderColor: COLORS.border,
paddingVertical: 28,
paddingHorizontal: 40,
marginVertical: 16,
alignItems: 'center',
},
text: {
flexDirection: 'row',
alignItems: 'center',
},
number: {
fontSize: 44,
fontWeight: '800',
color: COLORS.text,
fontVariant: ['tabular-nums'],
},
operator: {
fontSize: 36,
fontWeight: '600',
color: COLORS.primary,
},
equals: {
fontSize: 36,
fontWeight: '600',
color: COLORS.textDim,
},
questionMark: {
fontSize: 44,
fontWeight: '800',
color: COLORS.accent,
},
});
|