forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExperimentCardGroup.jsx
More file actions
41 lines (36 loc) · 1.01 KB
/
ExperimentCardGroup.jsx
File metadata and controls
41 lines (36 loc) · 1.01 KB
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
import PropTypes from 'prop-types';
import { Stack, Truncate } from '@openedx/paragon';
import { getGroupPercentage } from './utils';
const ExperimentCardGroup = ({ groups }) => {
const percentage = getGroupPercentage(groups.length);
return (
<Stack className="mb-3">
{groups.map((item) => (
<div
className="configuration-card-content__experiment-stack"
data-testid="configuration-card-content-experiment-stack"
key={item.id}
>
<Truncate.Deprecated lines={1}>{item.name}</Truncate.Deprecated>
<span>{percentage}</span>
</div>
))}
</Stack>
);
};
ExperimentCardGroup.propTypes = {
groups: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number,
name: PropTypes.string,
usage: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string,
url: PropTypes.string,
}),
),
version: PropTypes.number,
}),
).isRequired,
};
export default ExperimentCardGroup;