Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ var effect = 'zoomin',
function renderMenu(){
var component = (
<Menu effect={effect} method={method} position={pos}>
<MainButton iconResting="ion-plus-round" iconActive="ion-close-round" />
<MainButton iconRestingClass="ion-plus-round" iconActiveClass="ion-close-round" />
<ChildButton
//onClick={function(e){ console.log(e); e.preventDefault(); }}
icon="ion-social-github"
iconClass="ion-social-github"
label="View on Github"
href="https://github.com/nobitagit/react-material-floating-button/" />
<ChildButton
icon="ion-social-octocat"
iconClass="ion-social-octocat"
label="Follow me on Github"
href="https://github.com/nobitagit" />
<ChildButton
icon="ion-social-twitter"
iconClass="ion-social-twitter"
label="Share on Twitter"
href="http://twitter.com/share?text=Amazing Google Inbox style material floating menu as a React component!&url=http://nobitagit.github.io/react-material-floating-button/&hashtags=material,menu,reactjs,react,component" />
</Menu>
Expand Down
4 changes: 2 additions & 2 deletions src/child-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var ChildButton = React.createClass({
},

render: function(){
var iconClass = classnames('mfb-component__child-icon', this.props.icon);
var iconClass = classnames('mfb-component__child-icon', this.props.iconClass);
var className = classnames('mfb-component__button--child',
this.props.className,
{"mfb-component__button--disabled": this.props.disabled});
Expand All @@ -25,7 +25,7 @@ var ChildButton = React.createClass({
data-mfb-label={this.props.label}
onClick={this.handleOnClick}
className={className}>
<i className={iconClass}></i>
<i className={iconClass}>{this.props.icon}</i>
</a>
</li>
);
Expand Down
16 changes: 9 additions & 7 deletions src/main-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ var MainButton = React.createClass({
onClick: function(){},
iconResting: '',
iconActive: '',
label: null
label: null,
iconRestingClass: '',
iconActiveClass: ''
};
},
render: function(){
var iconResting = classnames('mfb-component__main-icon--resting', this.props.iconResting);
var iconActive = classnames('mfb-component__main-icon--active', this.props.iconActive);
var iconRestingClass = classnames('mfb-component__main-icon--resting', this.props.iconRestingClass);
var iconActiveClass = classnames('mfb-component__main-icon--active', this.props.iconActiveClass);
var mainClass = classnames('mfb-component__button--main', this.props.className);
if(this.props.label){
return (
<a href={this.props.href} className={mainClass} onClick={this.props.onClick} data-mfb-label={this.props.label}>
<i className={iconResting}></i>
<i className={iconActive}></i>
<i className={iconRestingClass}>{this.props.iconResting}</i>
<i className={iconActiveClass}>{this.props.iconActive}</i>
</a>
);
} else {
return (
<a href={this.props.href} className={mainClass} onClick={this.props.onClick}>
<i className={iconResting}></i>
<i className={iconActive}></i>
<i className={iconRestingClass}>{this.props.iconResting}</i>
<i className={iconActiveClass}>{this.props.iconActive}</i>
</a>
);
}
Expand Down