-
Notifications
You must be signed in to change notification settings - Fork 6
/
Foo.jsx
85 lines (78 loc) · 2.83 KB
/
Foo.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var React = require('react');
var Foo = React.createClass({
/**************************************************
* Component Specs && Lifecycle *
**************************************************/
propTypes: {
/**
* Initial value for Foo component in Foo Bar format.
* The Foo Bar format is enforced because it's the most reliable way to
* parse Foos.
*/
initialValue: fooBarFormat,
/**
* Buttons for Foo presets (e.g. "Bar", "Baz"). Each button
* should have the following properties:
* - `label` **(required)**: Display text for the button.
* - `value` **(required)**: The preset Foo or Foo range for the button.
* For single mode, this function should return a string in Foo Bar format.
* For `range` mode, this function should return an array
* of strings in Foo Bar format.
*/
buttons: React.PropTypes.arrayOf(
React.PropTypes.shape({
label: React.PropTypes.string.isRequired,
value: React.PropTypes.func.isRequired
})
),
/**
* Number of Foos to display side by side in the Baz.
* - Defaults to 2.
* - Max 2.
*/
foos: React.PropTypes.oneOf([1, 2]),
/**
* The first selectable Foo.
*/
disableBefore: React.PropTypes.string,
/**
* The last selectable Foo.
*/
disableAfter: React.PropTypes.string,
/**
* When a Foo is clicked in the Baz, this callback receives the
* new selected range as the first argument.
*
* The selected range will be an array of 2 Foos, and each Foo in the
* range is formatted as a Foo Bar Baz.
*/
onChange: React.PropTypes.func,
/**
* User-provided validator function for ranges a user is considering.
* This prop can be used to implement custom range restrictions. This
* function will be called with the range in the form of an array.
*
* For invalid ranges, this function should return an error message.
* Otherwise, it should not return anything.
*/
validate: React.PropTypes.func,
/**
* Boolean for whether or not the Baz should include
* Baz selection dropdowns.
*/
showBazSelector: React.PropTypes.bool
},
statics: {
FOO_BAR : BAR_BAZ,
BAZ_FOO : BAR_FOO
},
/**************************************************
* Rendering *
**************************************************/
render: function() {
return (
<div>Hello World, this is a Foo element.</div>
);
}
});
module.exports = Foo;