import React, { useState } from 'react'; import { View, ScrollView, Text, StyleSheet, Pressable } from 'react-native'; import { Ux4gStatusPipeline, Ux4gPipelineStep, Ux4gPipelineSize, } from '../components/status-pipeline'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; export const StatusPipelineShowcase: React.FC = () => { const theme = useUx4gTheme(); const [currentStep, setCurrentStep] = useState(1); const [pipelineSize, setPipelineSize] = useState('m'); const standardSteps: Ux4gPipelineStep[] = [ { label: 'Submitted', description: '5 Apr' }, { label: 'Verification', description: 'In progress' }, { label: 'Inspection', description: 'Est. 10 Apr' }, { label: 'Decision', description: 'Est. 18 Apr' }, { label: 'Issued', description: 'Est. 20 Apr' }, ]; const stateVariationSteps: Ux4gPipelineStep[] = [ { label: 'Order Placed', description: 'Completed', state: 'completed' }, { label: 'Document Review', description: 'Failed verification', state: 'error' }, { label: 'Payment Gateway', description: 'Pending retry', state: 'warning' }, { label: 'Approval Stage', description: 'Upcoming', state: 'upcoming' }, { label: 'Final Certificate', description: 'Est. 25 Apr', state: 'upcoming' }, ]; return ( {/* Card 1: Vertical Status Pipeline */} Status Pipeline — Vertical Flow Vertical step timeline demonstrating step states (`completed`, `current`, `upcoming`). Ported directly from Flutter `status_pipeline.dart`. {/* Step Nav Controls */} Pipeline Controls (Active Step: {currentStep + 1} of {standardSteps.length}) setCurrentStep((s) => Math.max(0, s - 1))} disabled={currentStep <= 0} style={[ styles.navButton, { backgroundColor: currentStep > 0 ? theme.colors.primary : `${theme.colors.onSurface}26`, flex: 1, marginRight: 6, }, ]} > Previous Step setCurrentStep((s) => Math.min(standardSteps.length - 1, s + 1))} disabled={currentStep >= standardSteps.length - 1} style={[ styles.navButton, { backgroundColor: currentStep < standardSteps.length - 1 ? theme.colors.primary : `${theme.colors.onSurface}26`, flex: 1, marginLeft: 6, }, ]} > Next Step {/* Size Preset Selector */} Size Preset: {(['s', 'm', 'l'] as Ux4gPipelineSize[]).map((sz) => ( setPipelineSize(sz)} style={[ styles.chip, { backgroundColor: pipelineSize === sz ? theme.colors.primary : `${theme.colors.onSurface}12`, }, ]} > Size {sz.toUpperCase()} ))} {/* Card 2: Horizontal Status Pipeline */} Status Pipeline — Horizontal Flow Horizontal layout connecting step circles and lines across screen width. {/* Card 3: State Variations (Error & Warning) */} State Variations (Error & Warning) Steps with explicit state overrides (`error` red circle, `warning` orange circle). ); }; const styles = StyleSheet.create({ container: { flex: 1, }, content: { padding: 16, }, card: { borderWidth: 1, borderRadius: 12, padding: 16, marginBottom: 20, }, cardTitle: { fontSize: 20, fontWeight: 'bold', marginBottom: 6, }, cardSubtitle: { fontSize: 13, lineHeight: 18, }, sectionTitle: { fontSize: 14, fontWeight: 'bold', }, controlRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginVertical: 6, }, navButton: { paddingVertical: 10, borderRadius: 8, alignItems: 'center', justifyContent: 'center', }, navButtonText: { color: '#FFFFFF', fontWeight: 'bold', fontSize: 13, }, chip: { paddingHorizontal: 12, paddingVertical: 6, borderRadius: 16, marginLeft: 6, }, });