forked from stac-labs/Spoke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectedCampaigns.jsx
49 lines (44 loc) · 1.01 KB
/
SelectedCampaigns.jsx
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
45
46
47
48
49
import PropTypes from "prop-types";
import React from "react";
import { StyleSheet, css } from "aphrodite";
import Chip from "material-ui/Chip";
const ssStyles = StyleSheet.create({
container: {
display: "flex",
flexWrap: "wrap"
}
});
const styles = {
chip: {
margin: 6
}
};
const SelectedCampaigns = props => (
<div className={css(ssStyles.container)}>
{props.campaigns.length ? (
<Chip
style={styles.chip}
key={0}
onClick={props.onClear}
backgroundColor="#FFC0CB"
>
Clear campaigns
</Chip>
) : null}
{props.campaigns.map(campaign => (
<Chip
style={styles.chip}
key={campaign.key}
onRequestDelete={() => props.onDeleteRequested(campaign.key)}
>
{campaign.text}
</Chip>
))}
</div>
);
SelectedCampaigns.propTypes = {
campaigns: PropTypes.array.isRequired,
onDeleteRequested: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired
};
export default SelectedCampaigns;