-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor PropertyActionButtons not to have the AddButton subcomp… (#834)
Refactor PropertyActionButtons not to have the AddButton subcomponent
- Loading branch information
Showing
3 changed files
with
33 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,17 @@ | ||
// Copyright 2019 Stanford University see LICENSE for license | ||
|
||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
export class AddButton extends Component { | ||
constructor(props) { | ||
super(props) | ||
} | ||
|
||
render() { | ||
return ( | ||
<button className="btn btn-default btn-sm" | ||
onClick={this.props.onClick} | ||
disabled={this.props.isDisabled}>Add</button> | ||
) | ||
} | ||
} | ||
|
||
export class PropertyActionButtons extends Component { | ||
constructor(props) { | ||
super(props) | ||
} | ||
|
||
render() { | ||
return (<div className="btn-group" role="group" aria-label="..."> | ||
<AddButton onClick={this.props.handleAddClick} isDisabled={this.props.addButtonDisabled}/> | ||
</div>) | ||
} | ||
} | ||
const PropertyActionButtons = props => (<div className="btn-group" role="group" aria-label="..."> | ||
<button className="btn btn-default btn-sm" | ||
onClick={ props.handleAddClick } | ||
disabled={ props.addButtonDisabled }>Add</button> | ||
</div>) | ||
|
||
PropertyActionButtons.propTypes = { | ||
addButtonDisabled: PropTypes.bool, | ||
handleAddClick: PropTypes.func, | ||
} | ||
|
||
AddButton.propTypes = { | ||
isDisabled: PropTypes.bool, | ||
onClick: PropTypes.func, | ||
reduxPath: PropTypes.array, | ||
} | ||
|
||
export default PropertyActionButtons |