Issue 266: Tabs added
This commit is contained in:
parent
6f068b5503
commit
6b6ff7ca22
3 changed files with 245 additions and 235 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import InlineSVG from 'react-inlinesvg';
|
import InlineSVG from 'react-inlinesvg';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
|
||||||
// import { bindActionCreators } from 'redux';
|
// import { bindActionCreators } from 'redux';
|
||||||
// import { connect } from 'react-redux';
|
// import { connect } from 'react-redux';
|
||||||
// import * as PreferencesActions from '../actions/preferences';
|
// import * as PreferencesActions from '../actions/preferences';
|
||||||
|
@ -71,240 +72,248 @@ class Preferences extends React.Component {
|
||||||
<InlineSVG src={exitUrl} alt="Exit Preferences" />
|
<InlineSVG src={exitUrl} alt="Exit Preferences" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="preference__subheadings">
|
<Tabs>
|
||||||
<h4 className="preference__subheading1">General Settings</h4>
|
<TabList>
|
||||||
<h4 className="preference__subheading2">Sketch Settings</h4>
|
<div className="preference__subheadings">
|
||||||
<h4 className="preference__subheading2">Accessibility</h4>
|
<Tab><h4 className="preference__subheading1">General Settings</h4></Tab>
|
||||||
</div>
|
<h4 className="preference__subheading2">Sketch Settings</h4>
|
||||||
<div className="preference">
|
<Tab><h4 className="preference__subheading2">Accessibility</h4></Tab>
|
||||||
<h4 className="preference__title">Theme</h4>
|
</div>
|
||||||
<div className="preference__options">
|
</TabList>
|
||||||
<input
|
<TabPanel>
|
||||||
type="radio"
|
<div className="preference">
|
||||||
onChange={() => this.props.setTheme('light')}
|
<h4 className="preference__title">Theme</h4>
|
||||||
aria-label="light theme on"
|
<div className="preference__options">
|
||||||
name="light theme"
|
<input
|
||||||
id="light-theme-on"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={() => this.props.setTheme('light')}
|
||||||
value="light"
|
aria-label="light theme on"
|
||||||
checked={this.props.theme === 'light'}
|
name="light theme"
|
||||||
/>
|
id="light-theme-on"
|
||||||
<label htmlFor="light-theme-on" className="preference__option">Light</label>
|
className="preference__radio-button"
|
||||||
<input
|
value="light"
|
||||||
type="radio"
|
checked={this.props.theme === 'light'}
|
||||||
onChange={() => this.props.setTheme('dark')}
|
/>
|
||||||
aria-label="dark theme on"
|
<label htmlFor="light-theme-on" className="preference__option">Light</label>
|
||||||
name="dark theme"
|
<input
|
||||||
id="dark-theme-on"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={() => this.props.setTheme('dark')}
|
||||||
value="dark"
|
aria-label="dark theme on"
|
||||||
checked={this.props.theme === 'dark'}
|
name="dark theme"
|
||||||
/>
|
id="dark-theme-on"
|
||||||
<label htmlFor="dark-theme-on" className="preference__option">Dark</label>
|
className="preference__radio-button"
|
||||||
<input
|
value="dark"
|
||||||
type="radio"
|
checked={this.props.theme === 'dark'}
|
||||||
onChange={() => this.props.setTheme('contrast')}
|
/>
|
||||||
aria-label="contrast theme on"
|
<label htmlFor="dark-theme-on" className="preference__option">Dark</label>
|
||||||
name="contrast theme"
|
<input
|
||||||
id="contrast-theme-on"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={() => this.props.setTheme('contrast')}
|
||||||
value="contrast"
|
aria-label="contrast theme on"
|
||||||
checked={this.props.theme === 'contrast'}
|
name="contrast theme"
|
||||||
/>
|
id="contrast-theme-on"
|
||||||
<label htmlFor="contrast-theme-on" className="preference__option">High contrast</label>
|
className="preference__radio-button"
|
||||||
</div>
|
value="contrast"
|
||||||
</div>
|
checked={this.props.theme === 'contrast'}
|
||||||
<div className="preference">
|
/>
|
||||||
<h4 className="preference__title">Text size</h4>
|
<label htmlFor="contrast-theme-on" className="preference__option">High contrast</label>
|
||||||
<button
|
</div>
|
||||||
className="preference__minus-button"
|
</div>
|
||||||
onClick={() => this.props.setFontSize(this.props.fontSize - 2)}
|
<div className="preference">
|
||||||
aria-label="decrease font size"
|
<h4 className="preference__title">Text size</h4>
|
||||||
>
|
<button
|
||||||
<InlineSVG src={minusUrl} alt="Decrease Font Size" />
|
className="preference__minus-button"
|
||||||
<h6 className="preference__label">Decrease</h6>
|
onClick={() => this.props.setFontSize(this.props.fontSize - 2)}
|
||||||
</button>
|
aria-label="decrease font size"
|
||||||
<input
|
>
|
||||||
className="preference__value"
|
<InlineSVG src={minusUrl} alt="Decrease Font Size" />
|
||||||
aria-live="polite"
|
<h6 className="preference__label">Decrease</h6>
|
||||||
aria-atomic="true"
|
</button>
|
||||||
role="status"
|
<input
|
||||||
value={this.props.fontSize}
|
className="preference__value"
|
||||||
onChange={this.handleUpdateFont}
|
aria-live="polite"
|
||||||
ref={(element) => { this.fontSizeInput = element; }}
|
aria-atomic="true"
|
||||||
onClick={() => {
|
role="status"
|
||||||
this.fontSizeInput.select();
|
value={this.props.fontSize}
|
||||||
}}
|
onChange={this.handleUpdateFont}
|
||||||
>
|
ref={(element) => { this.fontSizeInput = element; }}
|
||||||
</input>
|
onClick={() => {
|
||||||
<button
|
this.fontSizeInput.select();
|
||||||
className="preference__plus-button"
|
}}
|
||||||
onClick={() => this.props.setFontSize(this.props.fontSize + 2)}
|
>
|
||||||
aria-label="increase font size"
|
</input>
|
||||||
>
|
<button
|
||||||
<InlineSVG src={plusUrl} alt="Increase Font Size" />
|
className="preference__plus-button"
|
||||||
<h6 className="preference__label">Increase</h6>
|
onClick={() => this.props.setFontSize(this.props.fontSize + 2)}
|
||||||
</button>
|
aria-label="increase font size"
|
||||||
</div>
|
>
|
||||||
<div className="preference">
|
<InlineSVG src={plusUrl} alt="Increase Font Size" />
|
||||||
<h4 className="preference__title">Indentation amount</h4>
|
<h6 className="preference__label">Increase</h6>
|
||||||
<button
|
</button>
|
||||||
className="preference__minus-button"
|
</div>
|
||||||
onClick={() => this.props.setIndentation(this.props.indentationAmount - 2)}
|
<div className="preference">
|
||||||
aria-label="decrease indentation amount"
|
<h4 className="preference__title">Indentation amount</h4>
|
||||||
>
|
<button
|
||||||
<InlineSVG src={minusUrl} alt="DecreaseIndentation Amount" />
|
className="preference__minus-button"
|
||||||
<h6 className="preference__label">Decrease</h6>
|
onClick={() => this.props.setIndentation(this.props.indentationAmount - 2)}
|
||||||
</button>
|
aria-label="decrease indentation amount"
|
||||||
<input
|
>
|
||||||
className="preference__value"
|
<InlineSVG src={minusUrl} alt="DecreaseIndentation Amount" />
|
||||||
aria-live="polite"
|
<h6 className="preference__label">Decrease</h6>
|
||||||
aria-atomic="true"
|
</button>
|
||||||
role="status"
|
<input
|
||||||
value={this.props.indentationAmount}
|
className="preference__value"
|
||||||
onChange={this.handleUpdateIndentation}
|
aria-live="polite"
|
||||||
ref={(element) => { this.indentationInput = element; }}
|
aria-atomic="true"
|
||||||
onClick={() => {
|
role="status"
|
||||||
this.indentationInput.select();
|
value={this.props.indentationAmount}
|
||||||
}}
|
onChange={this.handleUpdateIndentation}
|
||||||
>
|
ref={(element) => { this.indentationInput = element; }}
|
||||||
</input>
|
onClick={() => {
|
||||||
<button
|
this.indentationInput.select();
|
||||||
className="preference__plus-button"
|
}}
|
||||||
onClick={() => this.props.setIndentation(this.props.indentationAmount + 2)}
|
>
|
||||||
aria-label="increase indentation amount"
|
</input>
|
||||||
>
|
<button
|
||||||
<InlineSVG src={plusUrl} alt="IncreaseIndentation Amount" />
|
className="preference__plus-button"
|
||||||
<h6 className="preference__label">Increase</h6>
|
onClick={() => this.props.setIndentation(this.props.indentationAmount + 2)}
|
||||||
</button>
|
aria-label="increase indentation amount"
|
||||||
<div className="preference__vertical-list">
|
>
|
||||||
<input
|
<InlineSVG src={plusUrl} alt="IncreaseIndentation Amount" />
|
||||||
type="radio"
|
<h6 className="preference__label">Increase</h6>
|
||||||
onChange={this.props.indentWithSpace}
|
</button>
|
||||||
aria-label="indentation with space"
|
<div className="preference__vertical-list">
|
||||||
name="indentation"
|
<input
|
||||||
id="indentation-space"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={this.props.indentWithSpace}
|
||||||
value="Spaces"
|
aria-label="indentation with space"
|
||||||
checked={!this.props.isTabIndent}
|
name="indentation"
|
||||||
/>
|
id="indentation-space"
|
||||||
<label htmlFor="indentation-space" className="preference__option">Spaces</label>
|
className="preference__radio-button"
|
||||||
<input
|
value="Spaces"
|
||||||
type="radio"
|
checked={!this.props.isTabIndent}
|
||||||
onChange={this.props.indentWithTab}
|
/>
|
||||||
aria-label="indentation with tab"
|
<label htmlFor="indentation-space" className="preference__option">Spaces</label>
|
||||||
name="indentation"
|
<input
|
||||||
id="indentation-tab"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={this.props.indentWithTab}
|
||||||
value="Tabs"
|
aria-label="indentation with tab"
|
||||||
checked={this.props.isTabIndent}
|
name="indentation"
|
||||||
/>
|
id="indentation-tab"
|
||||||
<label htmlFor="indentation-tab" className="preference__option">Tabs</label>
|
className="preference__radio-button"
|
||||||
</div>
|
value="Tabs"
|
||||||
</div>
|
checked={this.props.isTabIndent}
|
||||||
<div className="preference">
|
/>
|
||||||
<h4 className="preference__title">Autosave</h4>
|
<label htmlFor="indentation-tab" className="preference__option">Tabs</label>
|
||||||
<div className="preference__options">
|
</div>
|
||||||
<input
|
</div>
|
||||||
type="radio"
|
<div className="preference">
|
||||||
onChange={() => this.props.setAutosave(true)}
|
<h4 className="preference__title">Autosave</h4>
|
||||||
aria-label="autosave on"
|
<div className="preference__options">
|
||||||
name="autosave"
|
<input
|
||||||
id="autosave-on"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={() => this.props.setAutosave(true)}
|
||||||
value="On"
|
aria-label="autosave on"
|
||||||
checked={this.props.autosave}
|
name="autosave"
|
||||||
/>
|
id="autosave-on"
|
||||||
<label htmlFor="autosave-on" className="preference__option">On</label>
|
className="preference__radio-button"
|
||||||
<input
|
value="On"
|
||||||
type="radio"
|
checked={this.props.autosave}
|
||||||
onChange={() => this.props.setAutosave(false)}
|
/>
|
||||||
aria-label="autosave off"
|
<label htmlFor="autosave-on" className="preference__option">On</label>
|
||||||
name="autosave"
|
<input
|
||||||
id="autosave-off"
|
type="radio"
|
||||||
className="preference__radio-button"
|
onChange={() => this.props.setAutosave(false)}
|
||||||
value="Off"
|
aria-label="autosave off"
|
||||||
checked={!this.props.autosave}
|
name="autosave"
|
||||||
/>
|
id="autosave-off"
|
||||||
<label htmlFor="autosave-off" className="preference__option">Off</label>
|
className="preference__radio-button"
|
||||||
</div>
|
value="Off"
|
||||||
</div>
|
checked={!this.props.autosave}
|
||||||
<div className="preference">
|
/>
|
||||||
<h4 className="preference__title">Accessible text-based canvas</h4>
|
<label htmlFor="autosave-off" className="preference__option">Off</label>
|
||||||
<h6 className="preference__subtitle">Used with screen reader</h6>
|
</div>
|
||||||
<div className="preference__options">
|
</div>
|
||||||
<input
|
</TabPanel>
|
||||||
type="checkbox"
|
<TabPanel>
|
||||||
onChange={(event) => {
|
<div className="preference">
|
||||||
this.props.setTextOutput(event.target.checked);
|
<h4 className="preference__title">Accessible text-based canvas</h4>
|
||||||
}}
|
<h6 className="preference__subtitle">Used with screen reader</h6>
|
||||||
aria-label="text output on"
|
<div className="preference__options">
|
||||||
name="text output"
|
<input
|
||||||
id="text-output-on"
|
type="checkbox"
|
||||||
value="On"
|
onChange={(event) => {
|
||||||
checked={(this.props.textOutput)}
|
this.props.setTextOutput(event.target.checked);
|
||||||
/>
|
}}
|
||||||
<label htmlFor="text-output-on" className="preference__option preference__canvas">Plain-text</label>
|
aria-label="text output on"
|
||||||
<input
|
name="text output"
|
||||||
type="checkbox"
|
id="text-output-on"
|
||||||
onChange={(event) => {
|
value="On"
|
||||||
this.props.setGridOutput(event.target.checked);
|
checked={(this.props.textOutput)}
|
||||||
}}
|
/>
|
||||||
aria-label="table output on"
|
<label htmlFor="text-output-on" className="preference__option preference__canvas">Plain-text</label>
|
||||||
name="table output"
|
<input
|
||||||
id="table-output-on"
|
type="checkbox"
|
||||||
value="On"
|
onChange={(event) => {
|
||||||
checked={(this.props.gridOutput)}
|
this.props.setGridOutput(event.target.checked);
|
||||||
/>
|
}}
|
||||||
<label htmlFor="table-output-on" className="preference__option preference__canvas">Table-text</label>
|
aria-label="table output on"
|
||||||
<input
|
name="table output"
|
||||||
type="checkbox"
|
id="table-output-on"
|
||||||
onChange={(event) => {
|
value="On"
|
||||||
this.props.setSoundOutput(event.target.checked);
|
checked={(this.props.gridOutput)}
|
||||||
}}
|
/>
|
||||||
aria-label="sound output on"
|
<label htmlFor="table-output-on" className="preference__option preference__canvas">Table-text</label>
|
||||||
name="sound output"
|
<input
|
||||||
id="sound-output-on"
|
type="checkbox"
|
||||||
value="On"
|
onChange={(event) => {
|
||||||
checked={(this.props.soundOutput)}
|
this.props.setSoundOutput(event.target.checked);
|
||||||
/>
|
}}
|
||||||
<label htmlFor="sound-output-on" className="preference__option preference__canvas">Sound</label>
|
aria-label="sound output on"
|
||||||
</div>
|
name="sound output"
|
||||||
</div>
|
id="sound-output-on"
|
||||||
<div className="preference">
|
value="On"
|
||||||
<h4 className="preference__title">Lint warning sound</h4>
|
checked={(this.props.soundOutput)}
|
||||||
<div className="preference__options">
|
/>
|
||||||
<input
|
<label htmlFor="sound-output-on" className="preference__option preference__canvas">Sound</label>
|
||||||
type="radio"
|
</div>
|
||||||
onChange={() => this.props.setLintWarning(true)}
|
</div>
|
||||||
aria-label="lint warning on"
|
<div className="preference">
|
||||||
name="lint warning"
|
<h4 className="preference__title">Lint warning sound</h4>
|
||||||
id="lint-warning-on"
|
<div className="preference__options">
|
||||||
className="preference__radio-button"
|
<input
|
||||||
value="On"
|
type="radio"
|
||||||
checked={this.props.lintWarning}
|
onChange={() => this.props.setLintWarning(true)}
|
||||||
/>
|
aria-label="lint warning on"
|
||||||
<label htmlFor="lint-warning-on" className="preference__option">On</label>
|
name="lint warning"
|
||||||
<input
|
id="lint-warning-on"
|
||||||
type="radio"
|
className="preference__radio-button"
|
||||||
onChange={() => this.props.setLintWarning(false)}
|
value="On"
|
||||||
aria-label="lint warning off"
|
checked={this.props.lintWarning}
|
||||||
name="lint warning"
|
/>
|
||||||
id="lint-warning-off"
|
<label htmlFor="lint-warning-on" className="preference__option">On</label>
|
||||||
className="preference__radio-button"
|
<input
|
||||||
value="Off"
|
type="radio"
|
||||||
checked={!this.props.lintWarning}
|
onChange={() => this.props.setLintWarning(false)}
|
||||||
/>
|
aria-label="lint warning off"
|
||||||
<label htmlFor="lint-warning-off" className="preference__option">Off</label>
|
name="lint warning"
|
||||||
<button
|
id="lint-warning-off"
|
||||||
className="preference__preview-button"
|
className="preference__radio-button"
|
||||||
onClick={() => beep.play()}
|
value="Off"
|
||||||
aria-label="preview sound"
|
checked={!this.props.lintWarning}
|
||||||
>
|
/>
|
||||||
Preview sound
|
<label htmlFor="lint-warning-off" className="preference__option">Off</label>
|
||||||
</button>
|
<button
|
||||||
</div>
|
className="preference__preview-button"
|
||||||
</div>
|
onClick={() => beep.play()}
|
||||||
|
aria-label="preview sound"
|
||||||
|
>
|
||||||
|
Preview sound
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</TabPanel>
|
||||||
|
</Tabs>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
|
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
|
||||||
import SplitPane from 'react-split-pane';
|
import SplitPane from 'react-split-pane';
|
||||||
import Editor from '../components/Editor';
|
import Editor from '../components/Editor';
|
||||||
import Sidebar from '../components/Sidebar';
|
import Sidebar from '../components/Sidebar';
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
.preference__subheadings {
|
.preference__subheadings {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding-bottom: #{7 / $base-font-size}rem;
|
padding-bottom: #{0.1 / $base-font-size}rem;
|
||||||
@include themify() {
|
@include themify() {
|
||||||
border-bottom: 1px solid getThemifyVariable('button-border-color');
|
border-bottom: 1px solid getThemifyVariable('button-border-color');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue