import React from 'react'; /** * Compare Component * Four-column comparison: This District → Republican → Democratic → National */ export default function Compare({ benchmarks, metric = "value", prefix = "$", suffix = "" }) { const buckets = [ { key: 'thisDistrict', color: '#D85A30' }, { key: 'republicanAvg', color: '#BA7517' }, { key: 'democraticAvg', color: '#185FA5' }, { key: 'nationalAvg', color: '#1D9E75' } ]; return (
{buckets.map(bucket => { const data = benchmarks[bucket.key]; const value = typeof data === 'object' ? data[metric] : data; const label = typeof data === 'object' ? data.label : bucket.key; return (
{prefix}{value}{suffix}
{label}
); })}
); }