-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDropdown.js
More file actions
43 lines (37 loc) · 1.24 KB
/
Copy pathDropdown.js
File metadata and controls
43 lines (37 loc) · 1.24 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
import React from 'react';
import './Dropdown.css';
function Dropdown (props) {
// Build button classes based on props
const {style, type, shape, size, depth, visible, direction} = props;
const classNames = ['kc-Dropdown'];
classNames.push(`kc-Dropdown--${type || 'default'}`);
classNames.push(`kc-Dropdown--${size || 'medium'}`);
classNames.push(`kc-Dropdown--${depth || 'medium'}Depth`);
classNames.push(`kc-Dropdown--${shape || 'square'}`);
const outerCN = ['kc-Dropdown-outerWrapper'];
outerCN.push(`kc-Dropdown--${shape || 'square'}`);
//const {display} = style;
if (visible === false) {
//classNames.push('kc-Dropdown--hidden');
outerCN.push('kc-Dropdown--hidden');
} else {
//classNames.push('kc-Dropdown--visible');
outerCN.push('kc-Dropdown--visible');
}
const placementCN = ['kc-Dropdown-placementWrapper'];
if (direction === "right") {
placementCN.push('kc-Dropdown--rightward');
} else {
placementCN.push('kc-Dropdown--downward');
}
return (
<div className={placementCN.join(' ')}>
<div className={outerCN.join(' ')}>
<div style={style} className={classNames.join(' ')}>
{props.children}
</div>
</div>
</div>
);
}
export default Dropdown;