diff --git a/web/src/components/common/AggregationSelector.tsx b/web/src/components/common/AggregationSelector.tsx new file mode 100644 index 0000000..3f1dae8 --- /dev/null +++ b/web/src/components/common/AggregationSelector.tsx @@ -0,0 +1,51 @@ +import type {AggregationOptionValue} from '@/constants/metrics'; +import {cn} from '@/lib/utils'; + +export interface AggregationOption { + label: string; + value: AggregationOptionValue; +} + +interface AggregationSelectorProps { + value: AggregationOptionValue; + onChange: (value: AggregationOptionValue) => void; + options: readonly AggregationOption[]; + variant?: 'light' | 'dark'; +} + +export const AggregationSelector = ({ + value, + onChange, + options, + variant = 'light', + }: AggregationSelectorProps) => { + const isDark = variant === 'dark'; + + return ( +
+ {options.map((option) => { + const isActive = option.value === value; + return ( + + ); + })} +
+ ); +};