import React from 'react'; import Modal from 'react-modal'; import Icon from '/imports/ui/components/icon/component'; import Button from '/imports/ui/components/button/component'; import BaseMenu from '../base/component'; import ReactDOM from 'react-dom'; import cx from 'classnames'; import styles from '../styles.scss'; import Toggle from '/imports/ui/components/switch/component'; const MIN_FONTSIZE = 0; const MAX_FONTSIZE = 4; export default class ApplicationMenu extends BaseMenu { constructor(props) { super(props); this.state = { settingsName: 'application', settings: props.settings, }; } handleUpdateFontSize(size) { let obj = this.state; obj.settings.fontSize = size; this.handleUpdateSettings(this.state.settingsName, obj.settings); } setHtmlFontSize(size) { document.getElementsByTagName('html')[0].style.fontSize = size; }; changeFontSize(size) { let obj = this.state; obj.settings.fontSize = size; this.setState(obj, () => { this.setHtmlFontSize(this.state.settings.fontSize); this.handleUpdateFontSize(this.state.settings.fontSize); }); } handleIncreaseFontSize() { const currentFontSize = this.state.settings.fontSize; const availableFontSizes = this.props.fontSizes; const canIncreaseFontSize = availableFontSizes.indexOf(currentFontSize) < MAX_FONTSIZE; let fs = (canIncreaseFontSize) ? availableFontSizes.indexOf(currentFontSize) + 1 : MAX_FONTSIZE; this.changeFontSize(availableFontSizes[fs]); }; handleDecreaseFontSize() { const currentFontSize = this.state.settings.fontSize; const availableFontSizes = this.props.fontSizes; const canDecreaseFontSize = availableFontSizes.indexOf(currentFontSize) > MIN_FONTSIZE; let fs = (canDecreaseFontSize) ? availableFontSizes.indexOf(currentFontSize) - 1 : MIN_FONTSIZE; this.changeFontSize(availableFontSizes[fs]); }; render() { return (

Application

this.handleToggle('chatAudioNotifications')} />
this.handleToggle('chatPushNotifications')} />

); } };