Mobile App design
Run Tests on Branches / Detect Changes (push) Successful in 10s
Run Tests on Branches / Backend Tests (push) Successful in 2m12s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m47s

This commit is contained in:
Ichitux
2026-07-09 13:33:54 +02:00
parent 5f604b11ba
commit 2f36ef685d
32 changed files with 1793 additions and 926 deletions
+17 -21
View File
@@ -1,27 +1,32 @@
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { colors, borderRadius, spacing } from '../constants/theme';
import { useThemeContext } from './ThemeProvider';
import { borderRadius, spacing } from '../constants/theme';
interface StockBadgeProps {
stock: number;
}
export function StockBadge({ stock }: StockBadgeProps) {
const getBadgeStyle = () => {
if (stock === 0) return styles.danger;
if (stock < 5) return styles.warning;
return styles.success;
const { colors, isDark } = useThemeContext();
const getBadgeColors = () => {
if (stock === 0) {
return { bg: isDark ? '#3a1a1a' : '#feecec', text: isDark ? '#ef9a9a' : '#b91c1c' };
}
if (stock < 5) {
return { bg: isDark ? '#3a3010' : '#fff3cd', text: isDark ? '#ffd54f' : '#FF9500' };
}
return { bg: isDark ? '#1a3a1c' : '#eaf7ec', text: isDark ? '#81c784' : '#34C759' };
};
const getText = () => {
if (stock === 0) return 'Sin stock';
if (stock < 5) return `Bajo (${stock})`;
return `Disponible (${stock})`;
};
const badgeColors = getBadgeColors();
return (
<View style={[styles.badge, getBadgeStyle()]}>
<Text style={styles.text}>{getText()}</Text>
<View style={[styles.badge, { backgroundColor: badgeColors.bg }]}>
<Text style={[styles.text, { color: badgeColors.text }]}>
{stock === 0 ? 'Sin stock' : stock < 5 ? `Bajo (${stock})` : `Disponible (${stock})`}
</Text>
</View>
);
}
@@ -32,15 +37,6 @@ const styles = StyleSheet.create({
paddingVertical: spacing.xs,
borderRadius: borderRadius.sm,
},
success: {
backgroundColor: '#eaf7ec',
},
warning: {
backgroundColor: '#fff3cd',
},
danger: {
backgroundColor: '#feecec',
},
text: {
fontSize: 12,
fontWeight: '600',