-
-
Notifications
You must be signed in to change notification settings - Fork 503
Expand file tree
/
Copy pathSwitcher.jsx
More file actions
26 lines (24 loc) · 696 Bytes
/
Switcher.jsx
File metadata and controls
26 lines (24 loc) · 696 Bytes
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
import PureComponent from "../lib/PureComponent.jsx";
import * as styles from "./Switcher.css";
import SwitcherItem from "./SwitcherItem.jsx";
export default class Switcher extends PureComponent {
render() {
const { label, items, activeItem, onSwitch } = this.props;
return (
<div className={styles.container}>
<div className={styles.label}>{label}:</div>
<div>
{items.map((item) => (
<SwitcherItem
key={item.label}
className={styles.item}
item={item}
active={item === activeItem}
onClick={onSwitch}
/>
))}
</div>
</div>
);
}
}