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'); const beepUrl = require('../../../sounds/audioAlert.mp3'); 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); } handleLintWarning(event) { const value = event.target.value === 'true'; this.props.setLintWarning(value); } render() { const beep = new Audio(beepUrl); const preferencesContainerClass = classNames({ preferences: true, 'preferences--selected': this.props.isVisible }); return (

Preferences

Text Size

Indentation Amount

Autosave

this.props.setAutosave(true)} aria-label="autosave on" name="autosave" id="autosave-on" className="preference__radio-button" value="On" checked={this.props.autosave} /> this.props.setAutosave(false)} aria-label="autosave off" name="autosave" id="autosave-off" className="preference__radio-button" value="Off" checked={!this.props.autosave} />

Theme

this.props.setTheme('light')} aria-label="light theme on" name="light theme" id="light-theme-on" className="preference__radio-button" value="light" checked={this.props.theme === 'light'} /> this.props.setTheme('dark')} aria-label="dark theme on" name="dark theme" id="dark-theme-on" className="preference__radio-button" value="dark" checked={this.props.theme === 'dark'} /> this.props.setTheme('contrast')} aria-label="contrast theme on" name="contrast theme" id="contrast-theme-on" className="preference__radio-button" value="contrast" checked={this.props.theme === 'contrast'} />

Lint Warning Sound

this.props.setLintWarning(true)} aria-label="lint warning on" name="lint warning" id="lint-warning-on" className="preference__radio-button" value="On" checked={this.props.lintWarning} /> this.props.setLintWarning(false)} aria-label="lint warning off" name="lint warning" id="lint-warning-off" className="preference__radio-button" value="Off" checked={!this.props.lintWarning} />

Accessible Text-based Canvas

Used with screen reader
this.props.setTextOutput(true)} aria-label="text output on" name="text output" id="text-output-on" className="preference__radio-button" value="On" checked={this.props.textOutput} /> this.props.setTextOutput(false)} aria-label="text output off" name="text output" id="text-output-off" className="preference__radio-button" value="Off" checked={!this.props.textOutput} />
); } } 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, textOutput: PropTypes.bool.isRequired, setTextOutput: PropTypes.func.isRequired, lintWarning: PropTypes.bool.isRequired, setLintWarning: PropTypes.func.isRequired, theme: PropTypes.string.isRequired, setTheme: PropTypes.func.isRequired }; export default Preferences;