Worked on styling, got fixed info pages and the footer working correctly! Next, I need to add the dictionary settings page.

This commit is contained in:
Robbie Antenesse 2016-09-27 15:12:48 -06:00
parent e20395b642
commit 98b6377a01
10 changed files with 279 additions and 98 deletions

View File

@ -0,0 +1,69 @@
import React from 'react';
import {Button} from './Button';
export class FixedPage extends React.Component {
constructor(props) {
super(props);
this.state = {
display: false
};
this.hide = this.hide.bind(this);
}
conditionalDisplay() {
if (this.state.display) {
let contentClass = 'fixed-page-content';
if (this.props.contentClass) {
contentClass += ' ' + this.props.contentClass;
}
return (
<div id={this.props.id} className='fixed-page-container'>
<div className='fixed-page-background-fade' onClick={this.hide}></div>
<div className={contentClass}>
<Button classes='right-button'
action={this.hide}
label='Close' />
{this.props.children}
</div>
</div>
);
} else {
return (
<Button classes={this.props.buttonClasses}
action={() => this.show()}
label={this.props.buttonText} />
);
}
}
show() {
this.setState({
display: true
});
}
hide() {
this.setState({
display: false
});
}
render() {
return (
<div className='inline'>
{this.conditionalDisplay()}
</div>
);
}
}

44
src/components/Footer.jsx Normal file
View File

@ -0,0 +1,44 @@
import React from 'react';
import marked from 'marked';
import {FixedPage} from './FixedPage';
export class Footer extends React.Component {
constructor(props) {
super(props);
this.termsText = '# Terms \nTesting the terms';
this.privacyText = '# Privacy \nTesting the privacy';
}
render() {
return (
<footer>
<div id="footer-content">
Dictionary Builder only guaranteed to work with most up-to-date HTML5 browsers.
<a href="/issues" className="clickable inline-button" target="_blank">
Issues
</a>
<a href="/updates" className="clickable inline-button" target="_blank">
Updates
</a>
&nbsp;|&nbsp;
<FixedPage buttonClasses='inline-button' buttonText='Terms'>
<div dangerouslySetInnerHTML={{__html: marked(this.termsText)}} />
</FixedPage>
<FixedPage buttonClasses='inline-button' buttonText='Privacy'>
<div dangerouslySetInnerHTML={{__html: marked(this.privacyText)}} />
</FixedPage>
</div>
</footer>
);
}
}

View File

@ -1,6 +1,8 @@
import React from 'react'; import React from 'react';
import marked from 'marked';
import {Button} from './Button'; import {Button} from './Button';
import {FixedPage} from './FixedPage';
export class Header extends React.Component { export class Header extends React.Component {
constructor(props) { constructor(props) {
@ -10,6 +12,8 @@ export class Header extends React.Component {
loggedIn: false, loggedIn: false,
lockedOut: false lockedOut: false
} }
this.aboutText = '# About \nGet this later.';
} }
logUserIn() { logUserIn() {
@ -73,16 +77,23 @@ export class Header extends React.Component {
render() { render() {
return ( return (
<header> <header>
<div id="headerPadder"> <div id="headerPadder">
<a href="/" id="siteLogo">Lexiconga Dictionary Builder</a> <a href="/" id="siteLogo">Lexiconga Dictionary Builder</a>
<div className='button-group'> <div className='button-group'>
<Button
id='aboutButton' <FixedPage id='aboutButton' buttonText='About Lexiconga'>
action={() => alert('fixme')} <div dangerouslySetInnerHTML={{__html: marked(this.aboutText)}} />
label='About Lexiconga' /> </FixedPage>
</div> </div>
{this.showAccountButtons()} {this.showAccountButtons()}
</div> </div>
</header> </header>
); );
} }

View File

@ -3,6 +3,7 @@ import {Input} from './Input';
import {getInputSelection, setSelectionRange} from '../js/helpers'; import {getInputSelection, setSelectionRange} from '../js/helpers';
import {Button} from './Button'; import {Button} from './Button';
import {FixedPage} from './FixedPage';
export class TextArea extends Input { export class TextArea extends Input {
constructor(props) { constructor(props) {
@ -31,12 +32,17 @@ export class TextArea extends Input {
<label> <label>
<span> <span>
{this.props.name} {this.props.name}
<Button
classes='inline-button' <FixedPage id={this.props.id + '_textbox'} contentClass='no-scroll' buttonClasses='inline-button' buttonText='Maximize'>
action={() => this.handleMaximizeClick()} <label><span>{this.props.name}</span></label>
label='Maximize' />
<textarea id={this.props.id} className='fullscreen-textbox' onChange={this.handleOnChange} onKeyDown={this.handleOnKeyDown} value={this.state.value} />
</FixedPage>
</span> </span>
<textarea id={this.props.id} onChange={this.handleOnChange} onKeyDown={this.handleOnKeyDown} value={this.state.value} /> <textarea id={this.props.id} onChange={this.handleOnChange} onKeyDown={this.handleOnKeyDown} value={this.state.value} />
</label> </label>
); );
} }

View File

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import marked from 'marked';
import {WordForm} from './WordForm'; import {WordForm} from './WordForm';
import {Button} from './Button'; import {Button} from './Button';
@ -72,9 +73,7 @@ export class Word extends React.Component {
showLongDefinition() { showLongDefinition() {
if (this.props.longDefinition !== '') { if (this.props.longDefinition !== '') {
return ( return (
<div className='long-definition'> <div className='long-definition' dangerouslySetInnerHTML={{__html: marked(this.props.longDefinition)}} />
{this.props.longDefinition}
</div>
); );
} }
} }

View File

@ -5,8 +5,10 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import {Header} from './components/Header'; import {Header} from './components/Header';
import {Footer} from './components/Footer';
import {WordForm} from './components/WordForm'; import {WordForm} from './components/WordForm';
import {Button} from './components/Button'; import {Button} from './components/Button';
import {FixedPage} from './components/FixedPage';
import {Dictionary} from './components/Dictionary'; import {Dictionary} from './components/Dictionary';
import {dynamicSort} from './js/helpers'; import {dynamicSort} from './js/helpers';
@ -208,19 +210,17 @@ class Lexiconga extends React.Component {
return ( return (
<div> <div>
<Header /> <Header />
<WordForm addWord={(wordObject) => this.addWord(wordObject)} submitLabel='Add Word' />
<Button
action={() => this.changeDictionaryName()}
label='change name' />
<div className='left-column'>
<div className='floating-form'>
<WordForm addWord={(wordObject) => this.addWord(wordObject)} submitLabel='Add Word' />
</div>
</div>
<div className='center-column'>
<div id="incompleteNotice"> <div id="incompleteNotice">
Dictionary is complete: {this.state.settings.isComplete.toString()} Dictionary is complete: {this.state.settings.isComplete.toString()}
</div> </div>
<Dictionary
details={this.state.details}
words={this.state.words}
settings={this.state.settings}
updateWord={(wordId, wordObject) => this.updateWord(wordId, wordObject)} />
<Button <Button
action={() => this.saveLocalDictionary()} action={() => this.saveLocalDictionary()}
@ -229,6 +229,19 @@ class Lexiconga extends React.Component {
<Button <Button
action={() => this.loadLocalDictionary()} action={() => this.loadLocalDictionary()}
label='Load Dictionary' /> label='Load Dictionary' />
<FixedPage buttonClasses='right' buttonText='Edit Dictionary'>
</FixedPage>
<Dictionary
details={this.state.details}
words={this.state.words}
settings={this.state.settings}
updateWord={(wordId, wordObject) => this.updateWord(wordId, wordObject)} />
</div>
<Footer />
</div> </div>
); );
} }

View File

@ -4,6 +4,9 @@ body {
header { header {
background: #eacc9d; background: #eacc9d;
-webkit-box-shadow: $header-shadow;
-moz-box-shadow: $header-shadow;
box-shadow: $header-shadow;
} }
tr, thead { tr, thead {
@ -70,11 +73,11 @@ and (max-device-width : 480px) {
} }
} }
#wordEntryForm { .floating-form {
background: #ba5536; background: #ba5536;
-webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -webkit-box-shadow: $box-shadow;
-moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -moz-box-shadow: $box-shadow;
box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); box-shadow: $box-shadow;
border: none; border: none;
} }
@ -84,21 +87,33 @@ input, textarea, select, option {
#announcementArea { #announcementArea {
background: #a0c066; background: #a0c066;
-webkit-box-shadow: $box-shadow;
-moz-box-shadow: $box-shadow;
box-shadow: $box-shadow;
} }
#notificationArea { #notificationArea {
background: #c0c088; background: #c0c088;
-webkit-box-shadow: $box-shadow;
-moz-box-shadow: $box-shadow;
box-shadow: $box-shadow;
} }
#dictionaryColumn { .center-column {
background: #bd7251; background: #bd7251;
border: none; border: none;
-webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -webkit-box-shadow: $box-shadow;
-moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -moz-box-shadow: $box-shadow;
box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); box-shadow: $box-shadow;
} }
#settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { .fixed-page-content {
-webkit-box-shadow: $box-shadow;
-moz-box-shadow: $box-shadow;
box-shadow: $box-shadow;
}
.fixed-page-content {
background: #f2d5b2; background: #f2d5b2;
} }

View File

@ -1,4 +1,6 @@
* { * {
// position: relative;
// z-index: 0;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
@ -22,7 +24,7 @@ contents {
} }
header { header {
height: 50px; height: $header-height;
width: 100%; width: 100%;
margin: 0 0 10px; margin: 0 0 10px;
position: relative; position: relative;
@ -31,9 +33,6 @@ header {
right: 0px; right: 0px;
border: none; border: none;
padding: 0; padding: 0;
-webkit-box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75);
box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75);
.button-group { .button-group {
float: right; float: right;
@ -55,7 +54,7 @@ footer {
left: 0px; left: 0px;
background: #aaaaaa; background: #aaaaaa;
padding: 0; padding: 0;
max-height: 32px; /* Update Dictionary Container's bottom margin to account for footer */ max-height: $footer-height;
#footer-content { #footer-content {
padding: 8px; padding: 8px;
@ -86,21 +85,45 @@ td:last-child, th:last-child {
display: inline !important; display: inline !important;
} }
#leftColumn { .right {
float: right;
}
.column {
float: left; float: left;
margin: $column-margin;
}
.left-column {
@extend .column;
width: 25%; width: 25%;
margin: 15px 0 15px 15px; min-width: $min-column-width;
max-width: $max-column-width / 2;
}
.center-column {
@extend .column;
width: 50%;
margin-bottom: $column-margin + $footer-height;
min-width: $min-column-width;
max-width: $max-column-width;
padding: 15px;
}
.floating-form {
position: fixed;
top: $header-height + $column-margin;
width: 25%;
min-width: $min-column-width - ($column-margin * 2);
max-width: ($max-column-width / 2) - ($column-margin * 2);
} }
form { form {
padding: 15px; padding: 15px;
} }
#wordEntryForm {
max-width: 400px;
min-width: 260px;
}
.wbr:after { .wbr:after {
content: "\00200B"; content: "\00200B";
} }
@ -129,6 +152,11 @@ input, textarea {
padding: 2px 0 2px 5px; padding: 2px 0 2px 5px;
border: none; border: none;
margin: 2px 0; margin: 2px 0;
width: 100%;
}
textarea {
min-height: 125px;
} }
input[type=checkbox] { input[type=checkbox] {
@ -185,23 +213,6 @@ input[type=checkbox] {
margin: 0 auto 5px; margin: 0 auto 5px;
width:50%; width:50%;
min-width:200px; min-width:200px;
-webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
}
#dictionaryColumn {
width: 50%;
margin: 15px 0 36px 15px; /* bottom margin must clear footer */
padding: 0;
float: left;
}
#dictionaryContent {
width: 100%;
min-width: 260px;
max-width: 800px;
padding: 15px;
} }
#dictionaryName { #dictionaryName {
@ -230,6 +241,7 @@ input[type=checkbox] {
padding: 5px; padding: 5px;
border: none; border: none;
background: #dddddd; background: #dddddd;
margin: 0 3px;
} }
.clickable, button { .clickable, button {
@ -237,6 +249,7 @@ input[type=checkbox] {
} }
.inline-button { .inline-button {
display: inline-block !important;
font-size: 11px; font-size: 11px;
padding: 2px 4px; padding: 2px 4px;
} }
@ -374,7 +387,11 @@ searchTerm {
margin: 10px; margin: 10px;
} }
.fixedFade { .fixed-page-container {
position: relative;
z-index: 999;
.fixed-page-background-fade {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -382,9 +399,9 @@ searchTerm {
height: 100%; height: 100%;
background: #000000; background: #000000;
opacity: 0.6; opacity: 0.6;
} }
.fixedPage { .fixed-page-content {
position: fixed; position: fixed;
top: 5%; top: 5%;
left: 6%; left: 6%;
@ -395,25 +412,24 @@ searchTerm {
padding: 5px 5% 5%; padding: 5px 5% 5%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
background: #ffffff;
opacity: 1; opacity: 1;
border: none; border: none;
-webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); text-align: left;
-moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); }
box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
} }
.rightButton { .right-button {
float: right; @extend .right;
font-size: 12px; font-size: 12px;
} }
#fullScreenTextboxPage { .no-scroll {
padding: 5px 3% 4%; padding: 5px 3% 4% !important;
overflow-y: hidden; overflow-y: hidden !important;
} }
#fullScreenTextbox { .fullscreen-textbox {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;

7
src/sass/_variables.scss Normal file
View File

@ -0,0 +1,7 @@
$header-height: 50px;
$header-shadow: 0px 3px 10px -1px rgba(0, 0, 0, 0.75);
$box-shadow: 5px 5px 7px 0px rgba(0, 0, 0, 0.75);
$column-margin: 15px;
$min-column-width: 260px;
$max-column-width: 800px;
$footer-height: 32px;

View File

@ -1,3 +1,4 @@
@import 'variables';
@import 'styles'; @import 'styles';
@import 'lexiconga'; @import 'lexiconga';
@import 'mobile'; @import 'mobile';