-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating toggle button component to disable Bootstrap toggling it. Cl…
…oses #1004
- Loading branch information
1 parent
146b5d0
commit dcee459
Showing
1 changed file
with
14 additions
and
11 deletions.
There are no files selected for viewing
25 changes: 14 additions & 11 deletions
25
web-server/plugins/slycat-parameter-image/js/Components/ControlsButtonToggle.js
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,17 +1,20 @@ | ||
import React from "react"; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
|
||
const ControlsButtonToggle = (props) => { | ||
export default class ControlsButtonToggle extends React.PureComponent { | ||
render() { | ||
return ( | ||
<button data-toggle='button' | ||
className={`slycatControlsButtonToggle btn btn-sm ${props.button_style} ${props.active ? 'active' : 'notActive'}`} | ||
id={props.id} | ||
title={props.title} | ||
aria-pressed={props.active} | ||
onClick={props.set_active_state}> | ||
<FontAwesomeIcon icon={props.icon} /> | ||
<button | ||
// Don't set data-toggle because it now causes Bootstrap to activate and deactivate the button | ||
// automatically, which interferes with React's toggling of attributes based on props.active. | ||
// data-toggle='button' | ||
className={`slycatControlsButtonToggle btn btn-sm ${this.props.button_style} ${this.props.active ? 'active' : 'notActive'}`} | ||
id={this.props.id} | ||
title={this.props.title} | ||
aria-pressed={this.props.active} | ||
onClick={this.props.set_active_state}> | ||
<FontAwesomeIcon icon={this.props.icon} /> | ||
</button> | ||
); | ||
}; | ||
|
||
export default ControlsButtonToggle | ||
} | ||
} |