-
Notifications
You must be signed in to change notification settings - Fork 133
/
pricing-table.jsx
64 lines (57 loc) · 2.07 KB
/
pricing-table.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React from "react";
import classNames from "classnames";
import { HorizontalSplit } from "./index";
export class PricingTable extends React.Component {
render() {
return (
<div className="neal-pricing-table">
<HorizontalSplit>{this.props.children}</HorizontalSplit>
</div>
);
}
}
export class PricingPlan extends React.Component {
static propTypes = {
name: React.PropTypes.string.isRequired,
description: React.PropTypes.string,
price: React.PropTypes.node.isRequired,
period: React.PropTypes.string,
features: React.PropTypes.objectOf(React.PropTypes.bool),
buttonText: React.PropTypes.string,
onClick: React.PropTypes.func,
};
static defaultProps = {
period: "/month",
buttonText: "Sign up",
};
render() {
return (
<div className="card">
<div className="card-header neal-pricing-plan-name">
{this.props.name}
</div>
<div className="card-block">
<div className="text-xs-center neal-pricing-plan-price">
<h4 className="card-title neal-pricing-plan-price-amount">{this.props.price}</h4>
<span className="neal-pricing-plan-price-period">{this.props.period}</span>
</div>
<p className="card-text text-xs-center neal-pricing-plan-description">{this.props.description}</p>
<p className="card-text text-xs-center neal-pricing-plan-action">
<button className="btn btn-ghost btn-primary btn-lg" onClick={this.props.onClick}>
{this.props.buttonText}
</button>
</p>
</div>
<div className="card-block neal-pricing-plan-features">
<ul className="list-group list-group-flush">
{Object.keys(this.props.features).map((name, idx) => {
const isEnabled = this.props.features[name];
const _className = classNames("neal-pricing-plan-feature", { isEnabled, "isDisabled": !isEnabled });
return <li key={idx} className={_className}>{name}</li>;
})}
</ul>
</div>
</div>
);
}
}