import React, { PropTypes } from 'react'; import InlineSVG from 'react-inlinesvg'; import classNames from 'classnames'; // import { bindActionCreators } from 'redux'; // import { connect } from 'react-redux'; // import * as PreferencesActions from '../actions/preferences'; const exitUrl = require('../../../images/exit.svg'); const plusUrl = require('../../../images/plus.svg'); const minusUrl = require('../../../images/minus.svg'); class Preferences extends React.Component { constructor(props) { super(props); this.handleUpdateAutosave = this.handleUpdateAutosave.bind(this); } handleUpdateFont(event) { this.props.setFontSize(parseInt(event.target.value, 10)); } handleUpdateIndentation(event) { this.props.setIndentation(parseInt(event.target.value, 10)); } handleUpdateAutosave(event) { const value = event.target.value === 'true'; this.props.setAutosave(value); } render() { const preferencesContainerClass = classNames({ preferences: true, 'preferences--selected': this.props.isVisible }); let preferencesTabOptionClass = classNames({ preference__option: true, 'preference__option--selected': this.props.isTabIndent }); let preferencesSpaceOptionClass = classNames({ preference__option: true, 'preference__option--selected': !this.props.isTabIndent }); let autosaveOnClass = classNames({ preference__option: true, 'preference__option--selected': this.props.autosave }); let autosaveOffClass = classNames({ preference__option: true, 'preference__option--selected': !this.props.autosave }); return (

Preferences

Text Size

Indentation Amount

Autosave

); } } Preferences.propTypes = { isVisible: PropTypes.bool.isRequired, closePreferences: PropTypes.func.isRequired, fontSize: PropTypes.number.isRequired, indentationAmount: PropTypes.number.isRequired, setIndentation: PropTypes.func.isRequired, indentWithSpace: PropTypes.func.isRequired, indentWithTab: PropTypes.func.isRequired, isTabIndent: PropTypes.bool.isRequired, setFontSize: PropTypes.func.isRequired, autosave: PropTypes.bool.isRequired, setAutosave: PropTypes.func.isRequired }; export default Preferences;