diff options
Diffstat (limited to 'src/client/views/PropertiesSection.tsx')
-rw-r--r-- | src/client/views/PropertiesSection.tsx | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/src/client/views/PropertiesSection.tsx b/src/client/views/PropertiesSection.tsx index 3c9fa1123..b9a587719 100644 --- a/src/client/views/PropertiesSection.tsx +++ b/src/client/views/PropertiesSection.tsx @@ -1,5 +1,8 @@ +/* eslint-disable jsx-a11y/no-static-element-interactions */ +/* eslint-disable jsx-a11y/click-events-have-key-events */ +/* eslint-disable react/require-default-props */ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { action, computed, observable } from 'mobx'; +import { action, computed } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { SettingsManager } from '../util/SettingsManager'; @@ -10,8 +13,6 @@ export interface PropertiesSectionProps { children?: JSX.Element | string | null; isOpen: boolean; setIsOpen: (bool: boolean) => any; - inSection?: boolean; - setInSection?: (bool: boolean) => any; onDoubleClick?: () => void; } @@ -21,44 +22,35 @@ export class PropertiesSection extends React.Component<PropertiesSectionProps> { return SettingsManager.userColor; } - @computed get backgroundColor() { - return SettingsManager.userBackgroundColor; - } - @computed get variantColor() { return SettingsManager.userVariantColor; } - @observable isDouble: boolean = false; - render() { if (this.props.children === undefined || this.props.children === null) return null; - else - return ( - <div className="propertiesView-section" onPointerEnter={action(() => this.props.setInSection && this.props.setInSection(true))} onPointerLeave={action(() => this.props.setInSection && this.props.setInSection(false))}> - <div - className="propertiesView-sectionTitle" - onDoubleClick={action(e => { - this.isDouble = true; - this.props.onDoubleClick && this.props.onDoubleClick(); - this.props.setIsOpen(true); - setTimeout(() => (this.isDouble = false), 300); - })} - onClick={action(e => { - this.props.setIsOpen(!this.props.isOpen); - })} - style={{ - background: this.variantColor, - // this.props.isOpen ? this.variantColor : this.backgroundColor, - color: this.color, - }}> - {this.props.title} - <div className="propertiesView-sectionTitle-icon"> - <FontAwesomeIcon icon={this.props.isOpen ? 'caret-down' : 'caret-right'} size="lg" /> - </div> + return ( + <div className="propertiesView-section"> + <div + className="propertiesView-sectionTitle" + onDoubleClick={action(() => { + this.props.onDoubleClick && this.props.onDoubleClick(); + this.props.setIsOpen(true); + })} + onClick={action(() => { + this.props.setIsOpen(!this.props.isOpen); + })} + style={{ + background: this.variantColor, + // this.props.isOpen ? this.variantColor : this.backgroundColor, + color: this.color, + }}> + {this.props.title} + <div className="propertiesView-sectionTitle-icon"> + <FontAwesomeIcon icon={this.props.isOpen ? 'caret-down' : 'caret-right'} size="lg" /> </div> - {!this.props.isOpen ? null : <div className="propertiesView-content">{this.props.children}</div>} </div> - ); + {!this.props.isOpen ? null : <div className="propertiesView-content">{this.props.children}</div>} + </div> + ); } } |