New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.0.0 Button.js #632
3.0.0 Button.js #632
Changes from all commits
0d6178d
b8ca981
a26904d
853d6cd
940627f
ee27853
9f14daf
12f62b5
ee6b9d7
a72eee0
e400c1a
8dc6790
d53a08b
93f5a38
08cc808
186dfe1
be5c068
ec4764d
d275ead
5c04345
fbda675
6c70944
005f87e
2247f8a
b0756f1
f1455ee
589f8f6
614dd1d
50d8f75
02a39ee
9b49e92
fa5d968
696f65e
af5cde6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import Button from '../src/Button'; | ||
import Icon from '../src/Icon'; | ||
|
||
export default | ||
<div> | ||
<Button node='a' waves='light' small>Button</Button> | ||
<Button node='a' waves='light' small>Button<Icon left>cloud</Icon></Button> | ||
<Button node='a' waves='light' small>Button<Icon right>cloud</Icon></Button> | ||
</div>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,21 @@ class Button extends Component { | |
} | ||
|
||
componentDidMount() { | ||
const { tooltip, tooltipOptions } = this.props; | ||
if ( | ||
typeof $ !== 'undefined' && | ||
(typeof tooltip !== 'undefined' || typeof tooltipOptions !== 'undefined') | ||
) { | ||
$(this._btnEl).tooltip(tooltipOptions); | ||
if (!M) return; | ||
|
||
const { tooltip, tooltipOptions = {}, fab } = this.props; | ||
if (tooltip) { | ||
this.instance = M.Tooltip.init(this._btnEl, tooltipOptions); | ||
} | ||
|
||
if (fab) { | ||
this.instance = M.FloatingActionButton.init(this._floatingActionBtn); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need to check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The -10,106 changes are actually from my commit that removes the package.lock. BUT, I may have done something wrong trying to remove the file. @alextrastero, could you help me on this? What is the proper way to remove the file? Sorry about the trouble. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem! You can checkout any file from any branch like so: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Omg it worked 😄 Now I will work on the others tasks:
:) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done :) |
||
|
||
componentWillUnmount() { | ||
if (this.instance) { | ||
this.instance.destroy(); | ||
} | ||
} | ||
|
||
|
@@ -32,6 +41,7 @@ class Button extends Component { | |
flat, | ||
floating, | ||
large, | ||
small, | ||
disabled, | ||
waves, | ||
tooltip, | ||
|
@@ -50,9 +60,12 @@ class Button extends Component { | |
classes['waves-' + waves] = true; | ||
} | ||
|
||
let styles = { flat, floating, large }; | ||
let styles = { flat, floating, large, small }; | ||
constants.STYLES.forEach(style => { | ||
classes['btn-' + style] = styles[style]; | ||
if (styles[style]) { | ||
classes.btn = false; | ||
classes['btn-' + style] = true; | ||
} | ||
}); | ||
|
||
if (modal) { | ||
|
@@ -80,7 +93,10 @@ class Button extends Component { | |
renderFab(className, mode, clickOnly) { | ||
const classes = cx(mode, clickOnly); | ||
return ( | ||
<div className={cx('fixed-action-btn', classes)}> | ||
<div | ||
ref={el => (this._floatingActionBtn = el)} | ||
className={cx('fixed-action-btn', classes)} | ||
> | ||
<a className={className}>{this.renderIcon()}</a> | ||
<ul> | ||
{React.Children.map(this.props.children, child => { | ||
|
@@ -108,6 +124,7 @@ Button.propTypes = { | |
*/ | ||
flat: PropTypes.bool, | ||
large: PropTypes.bool, | ||
small: PropTypes.bool, | ||
floating: PropTypes.bool, | ||
/** | ||
* Fixed action button | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about an example of a Flat button, corresponding to the one in
materializecss
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.