File size: 933 Bytes
56b6519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';

import MetricButton from './metricButton';

type Option = {
  label: string;
  value: string;
};

type MetricGroupProps = {
  label: string;
  options: Option[];
  selectedOption: string;
  highlightedOption?: string;
  onSelect: (option: string) => void;
};

const MetricGroup: React.FC<MetricGroupProps> = ({
  label,
  options,
  selectedOption,
  highlightedOption = '',
  onSelect,
}) => {
  return (
    <div className="mb-6">
      <h4 className="mb-2 text-white">{label}</h4>
      <div className="flex flex-wrap gap-2">
        {options.map(option => (
          <MetricButton
            isHighlighted={option.value === highlightedOption}
            key={option.value}
            label={option.label}
            onClick={() => onSelect(option.value)}
            selected={selectedOption === option.value}
          />
        ))}
      </div>
    </div>
  );
};

export default MetricGroup;