Last active
August 3, 2016 16:38
-
-
Save balibou/67e857906490da9297c573ea27105b30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./imports/ui/components/plans-list.jsx | |
import React from 'react'; | |
import { ListGroup, Alert } from 'react-bootstrap'; | |
import { Plan } from './plan'; | |
export const PlansList = React.createClass({ | |
propTypes: { | |
plans: React.PropTypes.array, | |
chosenPlan: React.PropTypes.func, | |
}, | |
{/* Callback function from Plan component when a plan is clicked */} | |
handleSelectedPlan(plan) { | |
this.props.chosenPlan(plan); | |
}, | |
render() { | |
const { plans } = this.props; | |
return plans.length > 0 ? | |
<ListGroup componentClass="ul" className="price-list"> | |
{plans.map((plan) => ( | |
<Plan key={plan._id} plan={plan} selectedPlan={this.handleSelectedPlan}/> | |
))} | |
</ListGroup> | |
: | |
<Alert bsStyle="warning">No plans yet.</Alert>; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment