Skip to content
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

floatingButton refactor #83

Merged
merged 1 commit into from
Sep 23, 2016
Merged
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
37 changes: 17 additions & 20 deletions app/components/floating-button/FloatingButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ class FloatingButton extends Component {

handleClose = () => this.setState({ isShowingActions: false })

renderFloatingButtonDiv(type) {
const action = type.toLowerCase()
const iconName = action.replace(/ /g, '-')

return (
<div is="item" onClick={ () => this.props.showComposer(action) }>
<FloatingButtonItem label={ type }>
<Icon name={ iconName } />
</FloatingButtonItem>
</div>
)
}

render() {
return (<div
is="wrap"
Expand All @@ -45,26 +58,10 @@ class FloatingButton extends Component {
{ this.state.isShowingActions ?
<div>
<div is="buttons">
<div is="item" onClick={ this.props.showComposer.bind(this, 'add key') }>
<FloatingButtonItem label="Add Key">
<Icon name="add-key" />
</FloatingButtonItem>
</div>
<div is="item" onClick={ this.props.showComposer.bind(this, 'verify') }>
<FloatingButtonItem label="Verify">
<Icon name="verify" />
</FloatingButtonItem>
</div>
<div is="item" onClick={ this.props.showComposer.bind(this, 'sign') }>
<FloatingButtonItem label="Sign">
<Icon name="sign" />
</FloatingButtonItem>
</div>
<div is="item" onClick={ this.props.showComposer.bind(this, 'decrypt') }>
<FloatingButtonItem size="large" label="Decrypt" >
<Icon name="decrypt" />
</FloatingButtonItem>
</div>
{ this.renderFloatingButtonDiv('Add Key') }
{ this.renderFloatingButtonDiv('Verify') }
{ this.renderFloatingButtonDiv('Sign') }
{ this.renderFloatingButtonDiv('Decrypt') }
</div>
</div>
:
Expand Down