Skip to content

Commit 2d2fc93

Browse files
committed
Added simple button
1 parent 44908fb commit 2d2fc93

File tree

11 files changed

+112
-938
lines changed

11 files changed

+112
-938
lines changed

src/button/BrowseButton.js

Lines changed: 0 additions & 136 deletions
This file was deleted.

src/button/Button.js

Lines changed: 8 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,19 @@ import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import classnames from 'classnames';
44
import { themr } from 'react-css-themr';
5+
56
import InjectFontIcon from '../font_icon/FontIcon';
67
import rippleFactory from '../ripple/Ripple';
78

89
const factory = (ripple, FontIcon) => {
910
class Button extends Component {
10-
static propTypes = {
11-
accent: PropTypes.bool,
12-
children: PropTypes.node,
13-
className: PropTypes.string,
14-
disabled: PropTypes.bool,
15-
flat: PropTypes.bool,
16-
floating: PropTypes.bool,
17-
href: PropTypes.string,
18-
icon: PropTypes.oneOfType([
19-
PropTypes.string,
20-
PropTypes.element,
21-
]),
22-
inverse: PropTypes.bool,
23-
label: PropTypes.string,
24-
mini: PropTypes.bool,
25-
neutral: PropTypes.bool,
26-
onMouseLeave: PropTypes.func,
27-
onMouseUp: PropTypes.func,
28-
primary: PropTypes.bool,
29-
raised: PropTypes.bool,
30-
theme: PropTypes.shape({
31-
accent: PropTypes.string,
32-
button: PropTypes.string,
33-
flat: PropTypes.string,
34-
floating: PropTypes.string,
35-
icon: PropTypes.string,
36-
inverse: PropTypes.string,
37-
mini: PropTypes.string,
38-
neutral: PropTypes.string,
39-
primary: PropTypes.string,
40-
raised: PropTypes.string,
41-
rippleWrapper: PropTypes.string,
42-
toggle: PropTypes.string,
43-
}),
44-
type: PropTypes.string,
45-
};
46-
4711
static defaultProps = {
48-
accent: false,
12+
type: 'default',
13+
size: 'medium',
4914
className: '',
50-
flat: false,
51-
floating: false,
52-
mini: false,
53-
neutral: true,
54-
primary: false,
55-
raised: false,
56-
type: 'button',
15+
href: '',
5716
};
5817

59-
getLevel = () => {
60-
if (this.props.primary) return 'primary';
61-
if (this.props.accent) return 'accent';
62-
return 'neutral';
63-
}
64-
65-
getShape = () => {
66-
if (this.props.raised) return 'raised';
67-
if (this.props.floating) return 'floating';
68-
return 'flat';
69-
}
70-
7118
handleMouseUp = (event) => {
7219
this.buttonNode.blur();
7320
if (this.props.onMouseUp) this.props.onMouseUp(event);
@@ -79,32 +26,12 @@ const factory = (ripple, FontIcon) => {
7926
};
8027

8128
render() {
82-
const {
83-
accent, // eslint-disable-line
84-
children,
85-
className,
86-
flat, // eslint-disable-line
87-
floating, // eslint-disable-line
88-
href,
89-
icon,
90-
inverse,
91-
label,
92-
mini,
93-
neutral,
94-
primary, // eslint-disable-line
95-
raised, // eslint-disable-line
96-
theme,
97-
type,
98-
...others
99-
} = this.props;
29+
const { children, type, size, className, href, icon, theme, ...others } = this.props;
10030
const element = href ? 'a' : 'button';
101-
const level = this.getLevel();
102-
const shape = this.getShape();
10331

104-
const classes = classnames(theme.button, [theme[shape]], {
105-
[theme[level]]: neutral,
106-
[theme.mini]: mini,
107-
[theme.inverse]: inverse,
32+
const classes = classnames(theme.button, {
33+
[theme[type]]: true,
34+
[theme[size]]: true,
10835
}, className);
10936

11037
const props = {
@@ -115,13 +42,10 @@ const factory = (ripple, FontIcon) => {
11542
disabled: this.props.disabled,
11643
onMouseUp: this.handleMouseUp,
11744
onMouseLeave: this.handleMouseLeave,
118-
type: !href ? type : null,
119-
'data-react-toolbox': 'button',
12045
};
12146

12247
return React.createElement(element, props,
12348
icon ? <FontIcon className={theme.icon} value={icon} /> : null,
124-
label,
12549
children,
12650
);
12751
}

src/button/IconButton.js

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)