Skip to content

Commit 5463612

Browse files
committed
Add twitter icon into button
1 parent 7274ccf commit 5463612

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

example/twitter-example/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-login-component.js';
2+
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
33

44
class App extends Component {
55

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"webpack": "3.5.5"
5050
},
5151
"dependencies": {
52+
"react-icons": "^2.2.5",
5253
"url-search-params-polyfill": "^2.0.0",
5354
"whatwg-fetch": "2.0.3"
5455
}

src/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import 'whatwg-fetch'
44
import 'url-search-params-polyfill';
5+
import TwitterIcon from 'react-icons/lib/fa/twitter';
56

67

78
class TwitterLogin extends Component {
@@ -90,14 +91,22 @@ class TwitterLogin extends Component {
9091
});
9192
}
9293

94+
getDefaultButtonContent() {
95+
return (
96+
<span>
97+
<TwitterIcon color='#00aced' size={25}/> {this.props.text}
98+
</span>
99+
);
100+
}
101+
93102
render() {
94103
const twitterButton = React.createElement(
95104
this.props.tag, {
96105
onClick: this.onButtonClick,
97106
style: this.props.style,
98107
disabled: this.props.disabled,
99108
className: this.props.className,
100-
}, this.props.children ? this.props.children : this.props.text
109+
}, this.props.children ? this.props.children : this.getDefaultButtonContent()
101110
);
102111
return twitterButton;
103112
}
@@ -119,7 +128,7 @@ TwitterLogin.propTypes = {
119128

120129
TwitterLogin.defaultProps = {
121130
tag: 'button',
122-
text: 'Sign up with Twitter',
131+
text: 'Sign in with Twitter',
123132
disabled: false,
124133
dialogWidth: 600,
125134
dialogHeight: 400

0 commit comments

Comments
 (0)