|
|
|
import React from 'react';
|
|
|
|
import { View, StyleSheet } from 'react-native';
|
|
|
|
import { Text } from 'react-native-paper';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import fontSize from '../../utils/fontsizeUtils';
|
|
|
|
|
|
|
|
interface ProgressProps {
|
|
|
|
statuses: number;
|
|
|
|
labels?: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const Progress: React.FC<ProgressProps> = ({ statuses, labels = [] }) => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.mainContainer}>
|
|
|
|
<View style={styles.progressContainer}>
|
|
|
|
{labels.map((_, index) => (
|
|
|
|
<React.Fragment key={index}>
|
|
|
|
<View
|
|
|
|
style={[
|
|
|
|
styles.node,
|
|
|
|
index < statuses + 1 && styles.completedNode
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
{index < labels.length - 1 && (
|
|
|
|
<View
|
|
|
|
style={[
|
|
|
|
styles.line,
|
|
|
|
index < statuses && styles.completedLine
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</React.Fragment>
|
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
<View style={styles.labelsContainer}>
|
|
|
|
{labels.map((label, index) => (
|
|
|
|
<Text key={index} style={styles.label}>{label}</Text>
|
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
mainContainer: {
|
|
|
|
alignItems: 'center',
|
|
|
|
},
|
|
|
|
progressContainer: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginBottom: 10,
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
borderRadius: 10,
|
|
|
|
backgroundColor: '#E0E0E0',
|
|
|
|
},
|
|
|
|
completedNode: {
|
|
|
|
backgroundColor: '#4CAF50',
|
|
|
|
},
|
|
|
|
line: {
|
|
|
|
height: 2,
|
|
|
|
width: 40,
|
|
|
|
backgroundColor: '#E0E0E0',
|
|
|
|
},
|
|
|
|
completedLine: {
|
|
|
|
backgroundColor: '#4CAF50',
|
|
|
|
},
|
|
|
|
labelsContainer: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
width: '100%',
|
|
|
|
paddingHorizontal: 10,
|
|
|
|
},
|
|
|
|
label: {
|
|
|
|
fontSize: fontSize(12),
|
|
|
|
color: '#666',
|
|
|
|
textAlign: 'center',
|
|
|
|
width: 60,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Progress;
|