Skip to content

Commit dee983f

Browse files
author
Yury Shapkarin
committed
add react tip button
1 parent d28936e commit dee983f

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"description": "",
55
"main": "dist/index.js",
66
"browser": "dist/index.js",
7-
"dependencies": {},
7+
"dependencies": {
8+
"prop-types": "^15.7.2",
9+
"react": "^17.0.0"
10+
},
811
"files": [
912
"dist",
1013
"src"

src/button-react/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import createButton from '../button';
4+
5+
export default class Button extends React.Component {
6+
constructor(props) {
7+
super(props);
8+
this.button = React.createRef();
9+
this.componentDidMount = this.componentDidUpdate = () =>
10+
createButton(this.button.current, this.props);
11+
}
12+
13+
render() {
14+
return React.createElement('div', { ref: this.button });
15+
}
16+
};
17+
18+
Button.propTypes = {
19+
size: PropTypes.oneOf(['icon', 'small', 'medium', 'large']),
20+
url: PropTypes.string,
21+
account: PropTypes.string,
22+
};

0 commit comments

Comments
 (0)