-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathCoolButton.js
More file actions
43 lines (40 loc) · 1.07 KB
/
CoolButton.js
File metadata and controls
43 lines (40 loc) · 1.07 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
const classMap = {
// prop name: bulma class name
isCentered: 'is-centered',
isActive: 'is-active',
isBlack: 'is-black',
isDanger: 'is-danger',
isDark: 'is-dark',
isFocused: 'is-focused',
isGrouped: 'is-grouped',
isHovered: 'is-hovered',
isInfo: 'is-info',
isInverted: 'is-inverted',
isLarge: 'is-large',
isLight: 'is-light',
isLink: 'is-link',
isLoading: 'is-loading',
isMedium: 'is-medium',
isOutlined: 'is-outlined',
isPrimary: 'is-primary',
isRight: 'is-right',
isRounded: 'is-rounded',
isSelected: 'is-selected',
isSmall: 'is-small',
isStatic: 'is-static',
isSuccess: 'is-success',
isText: 'is-text',
isWarning: 'is-warning',
isWhite: 'is-white'
};
function CoolButton(props)
{
const classkeys = Object.keys(props).filter((prop) => classMap[prop])
const classNames=classkeys.map((prop) => classMap[prop]).join(' ');
return (
<button className={`button ${classNames}`}>
{props.children}
</button>
);
};
export default CoolButton;