start to add preferences styling

This commit is contained in:
Cassie Tarakajian 2017-11-13 19:09:08 -05:00
parent 9f9b09b99d
commit 9587d01908
3 changed files with 50 additions and 77 deletions

View file

@ -1,16 +1,13 @@
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 { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; 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';
const exitUrl = require('../../../images/exit.svg');
const plusUrl = require('../../../images/plus.svg'); const plusUrl = require('../../../images/plus.svg');
const minusUrl = require('../../../images/minus.svg'); const minusUrl = require('../../../images/minus.svg');
const beepUrl = require('../../../sounds/audioAlert.mp3'); const beepUrl = require('../../../sounds/audioAlert.mp3');
// import { debounce } from 'lodash';
class Preferences extends React.Component { class Preferences extends React.Component {
constructor(props) { constructor(props) {
@ -54,24 +51,9 @@ class Preferences extends React.Component {
render() { render() {
const beep = new Audio(beepUrl); const beep = new Audio(beepUrl);
const preferencesContainerClass = classNames({
'preferences': true,
'preferences--selected': this.props.isVisible
});
return ( return (
<section className={preferencesContainerClass} tabIndex="0" title="preference-menu"> <section className="preferences" tabIndex="0" title="preference-menu">
<div className="preferences__heading">
<h2 className="preferences__title">Settings</h2>
<button
className="preferences__exit-button"
onClick={this.props.closePreferences}
title="exit"
aria-label="exit preferences"
>
<InlineSVG src={exitUrl} alt="Exit Preferences" />
</button>
</div>
<Tabs> <Tabs>
<TabList> <TabList>
<div className="preference__subheadings"> <div className="preference__subheadings">
@ -320,8 +302,6 @@ class Preferences extends React.Component {
} }
Preferences.propTypes = { Preferences.propTypes = {
isVisible: PropTypes.bool.isRequired,
closePreferences: PropTypes.func.isRequired,
fontSize: PropTypes.number.isRequired, fontSize: PropTypes.number.isRequired,
indentationAmount: PropTypes.number.isRequired, indentationAmount: PropTypes.number.isRequired,
setIndentation: PropTypes.func.isRequired, setIndentation: PropTypes.func.isRequired,

View file

@ -246,29 +246,35 @@ class IDEView extends React.Component {
currentUser={this.props.user.username} currentUser={this.props.user.username}
showHelpModal={this.props.showHelpModal} showHelpModal={this.props.showHelpModal}
/> />
<Preferences {this.props.ide.preferencesIsVisible &&
isVisible={this.props.ide.preferencesIsVisible} <Overlay
closePreferences={this.props.closePreferences} title="Settings"
fontSize={this.props.preferences.fontSize} ariaLabel="settings"
indentationAmount={this.props.preferences.indentationAmount} closeOverlay={this.props.closePreferences}
setIndentation={this.props.setIndentation} >
indentWithSpace={this.props.indentWithSpace} <Preferences
indentWithTab={this.props.indentWithTab} fontSize={this.props.preferences.fontSize}
isTabIndent={this.props.preferences.isTabIndent} indentationAmount={this.props.preferences.indentationAmount}
setFontSize={this.props.setFontSize} setIndentation={this.props.setIndentation}
autosave={this.props.preferences.autosave} indentWithSpace={this.props.indentWithSpace}
setAutosave={this.props.setAutosave} indentWithTab={this.props.indentWithTab}
lintWarning={this.props.preferences.lintWarning} isTabIndent={this.props.preferences.isTabIndent}
setLintWarning={this.props.setLintWarning} setFontSize={this.props.setFontSize}
textOutput={this.props.preferences.textOutput} autosave={this.props.preferences.autosave}
gridOutput={this.props.preferences.gridOutput} setAutosave={this.props.setAutosave}
soundOutput={this.props.preferences.soundOutput} lintWarning={this.props.preferences.lintWarning}
setTextOutput={this.props.setTextOutput} setLintWarning={this.props.setLintWarning}
setGridOutput={this.props.setGridOutput} textOutput={this.props.preferences.textOutput}
setSoundOutput={this.props.setSoundOutput} gridOutput={this.props.preferences.gridOutput}
theme={this.props.preferences.theme} soundOutput={this.props.preferences.soundOutput}
setTheme={this.props.setTheme} setTextOutput={this.props.setTextOutput}
/> setGridOutput={this.props.setGridOutput}
setSoundOutput={this.props.setSoundOutput}
theme={this.props.preferences.theme}
setTheme={this.props.setTheme}
/>
</Overlay>
}
<div className="editor-preview-container"> <div className="editor-preview-container">
<SplitPane <SplitPane
split="vertical" split="vertical"
@ -361,25 +367,23 @@ class IDEView extends React.Component {
<div className="preview-frame-overlay" ref={(element) => { this.overlay = element; }}> <div className="preview-frame-overlay" ref={(element) => { this.overlay = element; }}>
</div> </div>
<div> <div>
{(() => { {(
if (
( (
(this.props.preferences.textOutput || (this.props.preferences.textOutput ||
this.props.preferences.gridOutput || this.props.preferences.gridOutput ||
this.props.preferences.soundOutput this.props.preferences.soundOutput
) && this.props.ide.isPlaying ) &&
) || this.props.ide.isAccessibleOutputPlaying) { this.props.ide.isPlaying
return ( ) ||
<AccessibleOutput this.props.ide.isAccessibleOutputPlaying
isPlaying={this.props.ide.isPlaying} ) &&
previewIsRefreshing={this.props.ide.previewIsRefreshing} <AccessibleOutput
textOutput={this.props.preferences.textOutput} isPlaying={this.props.ide.isPlaying}
gridOutput={this.props.preferences.gridOutput} previewIsRefreshing={this.props.ide.previewIsRefreshing}
/> textOutput={this.props.preferences.textOutput}
); gridOutput={this.props.preferences.gridOutput}
} />
return ''; }
})()}
</div> </div>
<PreviewFrame <PreviewFrame
htmlFile={this.props.htmlFile} htmlFile={this.props.htmlFile}

View file

@ -1,20 +1,10 @@
.preferences { .preferences {
@extend %modal; width: 100%;
position: absolute; max-width: #{640 / $base-font-size}rem;
top: #{113 / $base-font-size}rem;
right: #{192 / $base-font-size}rem;
width: #{640 / $base-font-size}rem;
height: #{540 / $base-font-size}rem;
bottom: #{371 / $base-font-size}rem;
margin-bottom: #{100 / $base-font-size}rem;
margin-right: #{100 / $base-font-size}rem;
display: none;
z-index: 9999; z-index: 9999;
padding: #{14 / $base-font-size}rem #{20 / $base-font-size}rem #{2 / $base-font-size}rem #{20 / $base-font-size}rem ; padding: #{14 / $base-font-size}rem #{20 / $base-font-size}rem #{2 / $base-font-size}rem #{20 / $base-font-size}rem ;
&--selected { display: flex;
display: flex; flex-direction: column;
flex-direction: column;
}
@include themify() { @include themify() {
background-color: getThemifyVariable('editor-gutter-color'); background-color: getThemifyVariable('editor-gutter-color');
} }
@ -173,13 +163,12 @@
} }
font-size: #{12 / $base-font-size}rem; font-size: #{12 / $base-font-size}rem;
height: #{25 / $base-font-size}rem; height: #{25 / $base-font-size}rem;
margin-top: #{30 / $base-font-size}rem;
margin-left: #{5 / $base-font-size}rem; margin-left: #{5 / $base-font-size}rem;
margin-bottom: #{0.1 / $base-font-size}rem; margin-bottom: #{0.1 / $base-font-size}rem;
margin-right: #{60 / $base-font-size}rem; margin-right: #{60 / $base-font-size}rem;
padding-right: #{10 / $base-font-size}rem; padding-right: #{10 / $base-font-size}rem;
font-family: Montserrat; font-family: Montserrat;
width: #{110 / $base-font-size}rem; width: 100%;
} }
.preference__vertical-list { .preference__vertical-list {