|
| 1 | +import React from 'react'; |
| 2 | +import { CycleFlow } from './CycleFlow'; |
| 3 | + |
| 4 | +export default { |
| 5 | + title: 'Visualization/CycleFlow', |
| 6 | + component: CycleFlow |
| 7 | +}; |
| 8 | + |
| 9 | +export const DatingCycle = () => ( |
| 10 | + <div style={{ width: '600px', height: '600px' }}> |
| 11 | + <CycleFlow |
| 12 | + width={600} |
| 13 | + height={600} |
| 14 | + edges={[ |
| 15 | + { |
| 16 | + source: 'More engaged user', |
| 17 | + target: 'Successful date', |
| 18 | + label: 'leads to', |
| 19 | + color: '#4CAF50' |
| 20 | + }, |
| 21 | + { |
| 22 | + source: 'Successful date', |
| 23 | + target: 'Match with someone', |
| 24 | + label: 'encourages', |
| 25 | + color: '#4CAF50' |
| 26 | + }, |
| 27 | + { |
| 28 | + source: 'Match with someone', |
| 29 | + target: 'More engaged user', |
| 30 | + label: '❌ becomes', |
| 31 | + // color: 'red', |
| 32 | + animated: false |
| 33 | + } |
| 34 | + ]} |
| 35 | + nodes={[ |
| 36 | + { id: 'More engaged user', color: '#4CAF50' }, |
| 37 | + { id: 'Successful date', color: '#2196F3' }, |
| 38 | + { id: 'Match with someone', color: '#FF5722' } |
| 39 | + ]} |
| 40 | + /> |
| 41 | + </div> |
| 42 | +); |
| 43 | + |
| 44 | +export const EconomicCycle = () => ( |
| 45 | + <div style={{ width: '700px', height: '700px', background: '#f9f9f9' }}> |
| 46 | + <CycleFlow |
| 47 | + width={700} |
| 48 | + height={700} |
| 49 | + edges={[ |
| 50 | + { |
| 51 | + source: 'Households', |
| 52 | + target: 'Firms', |
| 53 | + label: 'Consumption spending\n(300 billion pesos)', |
| 54 | + color: '#90A4AE' |
| 55 | + }, |
| 56 | + { |
| 57 | + source: 'Firms', |
| 58 | + target: 'Households', |
| 59 | + label: 'Wage income\n(300 billion pesos)', |
| 60 | + color: '#90A4AE' |
| 61 | + } |
| 62 | + ]} |
| 63 | + nodes={[ |
| 64 | + { id: 'Households', color: '#2E7D32' }, // Dark green |
| 65 | + { id: 'Firms', color: '#C62828' } // Dark red |
| 66 | + ]} |
| 67 | + /> |
| 68 | + </div> |
| 69 | +); |
| 70 | + |
| 71 | +export const SimpleExample = () => ( |
| 72 | + <div style={{ width: '400px', height: '400px' }}> |
| 73 | + <CycleFlow |
| 74 | + edges={[ |
| 75 | + { source: 'A', target: 'B', label: 'Step 1' }, |
| 76 | + { source: 'B', target: 'C', label: 'Step 2' }, |
| 77 | + { source: 'C', target: 'A', label: 'Step 3' } |
| 78 | + ]} |
| 79 | + // No node colors specified - will use defaults |
| 80 | + /> |
| 81 | + </div> |
| 82 | +); |
| 83 | + |
| 84 | +export const CustomAnimations = () => ( |
| 85 | + <div style={{ width: '600px', height: '600px', background: '#f5f5f5' }}> |
| 86 | + <CycleFlow |
| 87 | + width={600} |
| 88 | + height={600} |
| 89 | + edges={[ |
| 90 | + { |
| 91 | + source: 'Process A', |
| 92 | + target: 'Process B', |
| 93 | + label: 'Normal flow', |
| 94 | + animated: true |
| 95 | + }, |
| 96 | + { |
| 97 | + source: 'Process B', |
| 98 | + target: 'Process C', |
| 99 | + label: 'Static connection', |
| 100 | + animated: false, |
| 101 | + color: '#E91E63' |
| 102 | + }, |
| 103 | + { |
| 104 | + source: 'Process C', |
| 105 | + target: 'Process D', |
| 106 | + label: 'Colored flow', |
| 107 | + color: '#9C27B0' |
| 108 | + }, |
| 109 | + { |
| 110 | + source: 'Process D', |
| 111 | + target: 'Process A', |
| 112 | + label: 'Default flow' |
| 113 | + } |
| 114 | + ]} |
| 115 | + nodes={[ |
| 116 | + { id: 'Process A', color: '#3F51B5' }, |
| 117 | + { id: 'Process B', color: '#009688' }, |
| 118 | + { id: 'Process C', color: '#FFC107' }, |
| 119 | + { id: 'Process D', color: '#607D8B' } |
| 120 | + ]} |
| 121 | + /> |
| 122 | + </div> |
| 123 | +); |
0 commit comments