diff --git a/src/components/DetailPanel.tsx b/src/components/DetailPanel.tsx index 12b854a..18e5700 100644 --- a/src/components/DetailPanel.tsx +++ b/src/components/DetailPanel.tsx @@ -4,6 +4,7 @@ import { useDetailPanel } from '@/contexts/DetailPanelContext' import { useFocusTrap } from '@/hooks/useFocusTrap' import { DetailPanelContent } from '@/types/pmr' import type { CardHeaderProps } from './Card' +import { KPIDetail } from './detail/KPIDetail' // Width mapping from content type const widthMap: Record = { @@ -207,21 +208,26 @@ export function DetailPanel() { padding: '24px', }} > - {/* Placeholder content - actual renderers will be added in later stories */} -
-

- Detail panel for: {content.type} -

-

- Content renderers will be implemented in subsequent user stories. -

-
+ {/* Render content based on type */} + {content.type === 'kpi' && } + + {/* Other content types - placeholder for future stories */} + {content.type !== 'kpi' && ( +
+

+ Detail panel for: {content.type} +

+

+ Content renderers will be implemented in subsequent user stories. +

+
+ )} diff --git a/src/components/detail/KPIDetail.tsx b/src/components/detail/KPIDetail.tsx new file mode 100644 index 0000000..b446ff6 --- /dev/null +++ b/src/components/detail/KPIDetail.tsx @@ -0,0 +1,196 @@ +import type { KPI } from '@/types/pmr' + +interface KPIDetailProps { + kpi: KPI +} + +// Color map for KPI values +const colorMap: Record = { + green: '#059669', + amber: '#D97706', + teal: '#0D6E6E', +} + +export function KPIDetail({ kpi }: KPIDetailProps) { + // If story exists, render rich content; otherwise fallback to explanation + if (!kpi.story) { + return ( +
+
+ {kpi.value} +
+

{kpi.explanation}

+
+ ) + } + + const { context, role, outcomes, period } = kpi.story + + return ( +
+ {/* Headline number */} +
+
+ {kpi.value} +
+
+ {kpi.label} +
+
+ {kpi.sub} +
+
+ + {/* Period badge (if present) */} + {period && ( +
+ {period} +
+ )} + + {/* Context paragraph */} +
+

+ Context +

+

+ {context} +

+
+ + {/* Your role paragraph */} +
+

+ Your Role +

+

+ {role} +

+
+ + {/* Outcome bullets */} +
+

+ Key Outcomes +

+
    + {outcomes.map((outcome, index) => ( +
  • + {outcome} +
  • + ))} +
+
+
+ ) +}