UNPKG

4.37 kBJSXView Raw
1const React = require('react');
2const Demo = require('react-demo');
3const moment = require('moment-timezone');
4const {RouteHandler} = require('react-router');
5
6const {
7 AvailabilityGrid,
8 DatePicker,
9 Dropdown,
10 Footer,
11 Gravatar,
12 Icon,
13 NotificationView,
14 Loader
15} = require('../src')
16
17require('./styles/demo.less')
18
19class DemoPage extends React.Component {
20 render() {
21 const sampleDropdownData = [
22 { value: 'pizza', displayName: "Tasty Pizza"},
23 { value: 'waffles', displayName: "Delicious Waffles"},
24 { value: 'felafel', displayName: "I'm feelin Falafel"},
25 { value: 'bose', displayName: "No highs no lows, must be Bose"}
26 ];
27
28 const sampleNotifications = [
29 {
30 id: "9fc56050-61a1-11e5-8080-8001719413bb",
31 message: "Have opinions? Take our satisfaction survey!",
32 time: "2015-09-23T03:17:30.280968",
33 is_seen: false,
34 is_read: false
35 },
36 {
37 id: "9fc56050-61a1-11e5-8080-8001719413bb",
38 message: "Have opinions? Take our satisfaction survey!",
39 time: "2015-09-21T03:17:30.280968",
40 is_seen: false,
41 is_read: false
42 },
43 {
44
45 id: "9fc56050-61a1-11e5-8080-8001719413bb",
46 message: "Have opinions? Take our satisfaction survey!",
47 time: "2015-09-23T03:17:30.280968",
48 is_seen: true,
49 is_read: true
50 }
51 ]
52 const sampleUnseenCount = 2;
53
54 return (
55 <div className="tui-demo-page-container">
56 <div className="tui-demo-page">
57 <h1>Thinkful UI</h1>
58 <h3>NotificationView</h3>
59 <div style={{
60 'position': 'relative',
61 'height': '46px'
62 }}>
63 <NotificationView
64 notifications={sampleNotifications}
65 unseenCount={sampleUnseenCount} />
66 </div>
67
68 <h3>Gravatar</h3>
69 <Demo
70 target={Gravatar}
71 props={{
72 email: Demo.props.string('tholex@gmail.com'),
73 size: Demo.props.choices([60,120])
74 }} />
75
76 <h3>Icon</h3>
77 <Demo
78 target={Icon}
79 props={{
80 name: Demo.props.string('pointupright'),
81 className: Demo.props.string('additional-class')
82 }} />
83
84 <h3>Dropdown</h3>
85 <Demo
86 target={Dropdown}
87 props={{
88 data: Demo.props.constant(sampleDropdownData),
89 initialSelectedInd: Demo.props.choices([undefined,0,1,2]),
90 defaultDisplay: Demo.props.string("Choose something awesome"),
91 handleChange: Demo.props.callback.log(e => e.target.getAttribute('value'))
92 }} />
93
94 <h3>DatePicker</h3>
95 <Demo
96 target={DatePicker}
97 props={{
98 defaultDate: Demo.props.constant(moment()),
99 className: Demo.props.choices(['additional-class', '']),
100 handleChange: Demo.props.callback.log(date => moment(date).format('YYYY-MM-DD'))
101 }} />
102
103 <h3>AvailabilityGrid</h3>
104 <Demo
105 target={AvailabilityGrid}
106 props={{
107 bitmap: Demo.props.string("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
108 slotsHour: Demo.props.constant(1),
109 maxHour: Demo.props.constant(24),
110 minHour: Demo.props.constant(0),
111 disabled: Demo.props.choices([false, true])
112 }} />
113
114 <h3>Loader</h3>
115 <Demo
116 target={Loader}
117 props={{
118 className: Demo.props.constant('additional-class')
119 }} />
120
121 <RouteHandler />
122 </div>
123 <Footer/>
124 </div>);
125 }
126}
127
128module.exports = {DemoPage};