diff options
author | Aubrey Li <Aubrey-Li> | 2021-09-15 14:41:24 -0400 |
---|---|---|
committer | Aubrey Li <Aubrey-Li> | 2021-09-15 14:41:24 -0400 |
commit | eb63330e172935343767d0dcc7ffad9bfa1a75c4 (patch) | |
tree | 031bf155df50200f9652e881aec18002bc9e399e /src/client/views/nodes/button/toggleButton/ToggleButton.tsx | |
parent | b7a88c6292c2e7bfffc3cdc4f7c7037922b3de25 (diff) | |
parent | 8386ad690c10d5c76bbd1b4f85314514b7f11b55 (diff) |
merge master into trails-aubrey
Diffstat (limited to 'src/client/views/nodes/button/toggleButton/ToggleButton.tsx')
-rw-r--r-- | src/client/views/nodes/button/toggleButton/ToggleButton.tsx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/client/views/nodes/button/toggleButton/ToggleButton.tsx b/src/client/views/nodes/button/toggleButton/ToggleButton.tsx new file mode 100644 index 000000000..dca6487d8 --- /dev/null +++ b/src/client/views/nodes/button/toggleButton/ToggleButton.tsx @@ -0,0 +1,34 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { Component } from 'react'; +import { BoolCast } from '../../../../../fields/Types'; +import { Colors } from '../../../global/globalEnums'; +import { IButtonProps } from '../ButtonInterface'; + +export class ToggleButton extends Component<IButtonProps> { + render() { + const type = this.props.type; + // Determine the type of toggle button + const switchToggle: boolean = BoolCast(this.props.rootDoc.switchToggle); + + if (switchToggle) { + return ( + <div className={`menuButton ${type} ${'switch'}`}> + <label className="switch"> + <input type="checkbox" + checked={this.props.backgroundColor === Colors.MEDIUM_BLUE} + /> + <span className="slider round"></span> + </label> + </div> + ); + } else { + return ( + <div className={`menuButton ${type}`} + style={{ opacity: 1, backgroundColor: this.props.backgroundColor, color: this.props.color }}> + <FontAwesomeIcon className={`fontIconBox-icon-${type}`} icon={this.props.icon} color={this.props.color} /> + {this.props.label} + </div> + ); + } + } +}
\ No newline at end of file |