UNPKG

5.62 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 Loader,
14 NotificationView,
15 OpenSessionOverview
16} = require('../src')
17
18require('./styles/demo.less')
19
20class DemoPage extends React.Component {
21 render() {
22 const sampleDropdownData = [
23 { value: 'pizza', displayName: "Tasty Pizza"},
24 { value: 'waffles', displayName: "Delicious Waffles"},
25 { value: 'felafel', displayName: "I'm feelin Falafel"},
26 { value: 'bose', displayName: "No highs no lows, must be Bose"}
27 ];
28
29 const sampleNotifications = [
30 {
31 id: "9fc56050-61a1-11e5-8080-8001719413bb",
32 message: "Have opinions? Take our satisfaction survey!",
33 time: "2015-09-23T03:17:30.280968",
34 is_seen: false,
35 is_read: false
36 },
37 {
38 id: "9fc56050-61a1-11e5-8080-8001719413bb",
39 message: "Have opinions? Take our satisfaction survey!",
40 time: "2015-09-21T03:17:30.280968",
41 is_seen: false,
42 is_read: false
43 },
44 {
45
46 id: "9fc56050-61a1-11e5-8080-8001719413bb",
47 message: "Have opinions? Take our satisfaction survey!",
48 time: "2015-09-23T03:17:30.280968",
49 is_seen: true,
50 is_read: true
51 }
52 ]
53 const sampleUnseenCount = 2;
54
55 return (
56 <div className="tui-demo-page-container">
57 <div className="tui-demo-page">
58 <h1>Thinkful UI</h1>
59 <h3>NotificationView</h3>
60 <div style={{
61 'position': 'relative',
62 'height': '46px'
63 }}>
64 <NotificationView
65 notifications={sampleNotifications}
66 unseenCount={sampleUnseenCount} />
67 </div>
68
69 <h3>Gravatar</h3>
70 <Demo
71 target={Gravatar}
72 props={{
73 email: Demo.props.string('tholex@gmail.com'),
74 size: Demo.props.choices([60,120])
75 }} />
76
77 <h3>Icon</h3>
78 <Demo
79 target={Icon}
80 props={{
81 name: Demo.props.string('pointupright'),
82 className: Demo.props.string('additional-class')
83 }} />
84
85 <h3>Dropdown</h3>
86 <Demo
87 target={Dropdown}
88 props={{
89 data: Demo.props.constant(sampleDropdownData),
90 initialSelectedInd: Demo.props.choices([undefined,0,1,2]),
91 defaultDisplay: Demo.props.string("Choose something awesome"),
92 handleChange: Demo.props.callback.log(e => e.target.getAttribute('value'))
93 }} />
94
95 <h3>DatePicker</h3>
96 <Demo
97 target={DatePicker}
98 props={{
99 defaultDate: Demo.props.constant(moment()),
100 className: Demo.props.choices(['additional-class', '']),
101 handleChange: Demo.props.callback.log(date => moment(date).format('YYYY-MM-DD'))
102 }} />
103
104 <h3>AvailabilityGrid</h3>
105 <Demo
106 target={AvailabilityGrid}
107 props={{
108 bitmap: Demo.props.string("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000111111110000000000001111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
109 slotsHour: Demo.props.constant(1),
110 maxHour: Demo.props.constant(24),
111 minHour: Demo.props.constant(0),
112 disabled: Demo.props.choices([false, true])
113 }} />
114
115 <h3>Loader</h3>
116 <Demo
117 target={Loader}
118 props={{
119 className: Demo.props.constant('additional-class')
120 }} />
121
122 <h3>OpenSessionOverview</h3>
123 <Demo
124 target={OpenSessionOverview}
125 props={{
126 session: Demo.props.json({
127 background_image_url: 'https://s3-us-west-2.amazonaws.com/sourcegraph-assets/blog/einstein_code.jpeg',
128 description: 'Git is the most popular versioning control software and is essential for any developer\'s workflow. We\'ll discuss basic git commands, the GitHub interface, and how to host your website on GitHub pages for free.',
129 endDtLocal: (e => moment().add(1, 'h').endOf('h')),
130 host: {
131 name: 'Elon Musk',
132 image_url: 'https://pbs.twimg.com/profile_images/378800000305778238/852d2f76797dbe1da82095f988d38fbe_400x400.png'
133 },
134 isHappeningNow: (e => {return false}),
135 isPast: (e => {return false}),
136 isStartingSoon: (e => {return false}),
137 isWorkshop: (e => {return true}),
138 startDtLocal: (e => moment().add(1, 'h').startOf('h')),
139 tags: ['React', 'demo', 'github', 'all of the tags'],
140 title: 'Intro to GitHub'
141 })
142 }}/>
143
144 <RouteHandler />
145 </div>
146 <Footer/>
147 </div>);
148 }
149}
150
151module.exports = {DemoPage};