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,9 +246,13 @@ class IDEView extends React.Component {
currentUser={this.props.user.username} currentUser={this.props.user.username}
showHelpModal={this.props.showHelpModal} showHelpModal={this.props.showHelpModal}
/> />
{this.props.ide.preferencesIsVisible &&
<Overlay
title="Settings"
ariaLabel="settings"
closeOverlay={this.props.closePreferences}
>
<Preferences <Preferences
isVisible={this.props.ide.preferencesIsVisible}
closePreferences={this.props.closePreferences}
fontSize={this.props.preferences.fontSize} fontSize={this.props.preferences.fontSize}
indentationAmount={this.props.preferences.indentationAmount} indentationAmount={this.props.preferences.indentationAmount}
setIndentation={this.props.setIndentation} setIndentation={this.props.setIndentation}
@ -269,6 +273,8 @@ class IDEView extends React.Component {
theme={this.props.preferences.theme} theme={this.props.preferences.theme}
setTheme={this.props.setTheme} 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 ( ) ||
this.props.ide.isAccessibleOutputPlaying
) &&
<AccessibleOutput <AccessibleOutput
isPlaying={this.props.ide.isPlaying} isPlaying={this.props.ide.isPlaying}
previewIsRefreshing={this.props.ide.previewIsRefreshing} previewIsRefreshing={this.props.ide.previewIsRefreshing}
textOutput={this.props.preferences.textOutput} textOutput={this.props.preferences.textOutput}
gridOutput={this.props.preferences.gridOutput} 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 {