Files
mobile-darmasaba/components/labelStatus.tsx
2026-02-12 17:52:19 +08:00

34 lines
1.1 KiB
TypeScript

import { useTheme } from "@/providers/ThemeProvider";
import Styles from "@/constants/Styles";
import { View, StyleProp, ViewStyle } from "react-native";
import Text from "./Text";
type Props = {
category: 'error' | 'success' | 'warning' | 'primary' | 'secondary'
text: string
size: 'small' | 'default'
style?: StyleProp<ViewStyle>
}
export default function LabelStatus({ category, text, size, style }: Props) {
const { colors } = useTheme();
const backgroundColor = {
primary: colors.primary,
success: colors.success,
warning: colors.warning,
error: colors.error,
secondary: 'gray',
}[category] || 'gray'; // Removed ColorsStatus[category]?.backgroundColor as ColorsStatus is removed
return (
<View style={[
size == "small" ? Styles.labelStatusSmall : Styles.labelStatus,
{ backgroundColor },
Styles.round05,
Styles.contentItemCenter,
style
]}>
<Text style={[size == "small" ? Styles.textSmallSemiBold : Styles.textMediumSemiBold, Styles.cWhite, { textAlign: 'center' }]}>{text}</Text>
</View>
)
}