Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ecoscan_app/components/alternatives/ProductCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { View, StyleSheet } from "react-native";
import { Card, Text, Icon, useTheme } from "react-native-paper";
import { StyleSheet, View } from "react-native";
import { Card, Icon, Text } from "react-native-paper";
import { getScoreColor } from "@/utils/scoreColor";

type ProductCardProps = {
title: string;
Expand All @@ -14,16 +15,17 @@ export default function ProductCard({
image,
score,
}: ProductCardProps) {
const theme = useTheme();
const scoreColor = getScoreColor(score);

return (
<Card style={styles.card}>
<View style={styles.cardHeader}>
<Text variant="bodySmall" style={styles.cardHeaderText}>
Dein gescanntes Produkt
</Text>
<View style={styles.scoreBadge}>
<Icon source="leaf" size={22} color="#009A0A" />
<Text style={{ ...styles.scoreText, color: theme.colors.primary }}>
<Icon source="leaf" size={22} color={scoreColor} />
<Text style={{ ...styles.scoreText, color: scoreColor }}>
{score}
</Text>
</View>
Expand All @@ -49,7 +51,7 @@ export default function ProductCard({

const styles = StyleSheet.create({
card: {
backgroundColor: "#e3e3e3",
backgroundColor: "#ececec",
borderRadius: 16,
padding: 12,
marginVertical: 16,
Expand Down
Loading