-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.jsx
More file actions
55 lines (51 loc) · 1.82 KB
/
demo.jsx
File metadata and controls
55 lines (51 loc) · 1.82 KB
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
import React from 'react'
import DropdownBtn from './index'
import { Dropdown } from './index'
class DropdownItemDemo extends React.Component {
render() {
return <li>Item: {this.props.obj.value}</li>
}
}
const ITEMS1 = [
'First',
'Second',
'Third'
]
const ITEMS2 = [
{ Com: DropdownItemDemo, value: 1 },
{ Com: DropdownItemDemo, value: 2 },
{ Com: DropdownItemDemo, value: 3 }
]
export default class DropdownDemo extends React.Component {
render() {
const onSelect = o => console.log('selected', o)
const onClose = o => console.log('close')
return <div>
<h1>patchkit-dropdown</h1>
<section className="demo-dropdown">
<header><Dropdown items="..."></header>
<div className="content" style={{minHeight: '100px'}}>
<Dropdown items={ITEMS1} isOpen onSelect={onSelect} onClose={onClose} />
</div>
</section>
<section className="demo-dropdown-customcom">
<header><Dropdown items="..."> (custom component)</header>
<div className="content" style={{minHeight: '100px'}}>
<Dropdown items={ITEMS2} isOpen onSelect={onSelect} onClose={onClose} />
</div>
</section>
<section className="demo-dropdown-btn">
<header><DropdownBtn items="..."></header>
<div className="content">
<DropdownBtn className="btn highlighted" items={ITEMS1} onSelect={onSelect} onClose={onClose}>Click to open</DropdownBtn>
</div>
</section>
<section className="demo-dropdown-btn-right" style={{marginBottom: 200}}>
<header><DropdownBtn items="..." right></header>
<div className="content">
<DropdownBtn right className="btn highlighted" items={ITEMS1} onSelect={onSelect} onClose={onClose}>Click to open</DropdownBtn>
</div>
</section>
</div>
}
}