diff --git a/src/components/Button.jsx b/src/components/Button.jsx
new file mode 100644
index 0000000..76077a0
--- /dev/null
+++ b/src/components/Button.jsx
@@ -0,0 +1,32 @@
+import React from 'react';
+
+export class Button extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ processClasses() {
+ var classes = 'clickable';
+
+ if (this.props.classes) {
+ classes += ' ' + this.props.classes;
+ }
+
+ return classes;
+ }
+
+ render() {
+ return (
+
+ {this.props.label}
+
+ );
+ }
+}
+
+Button.defaultProps = {
+ action: () => console.log('no action bound to button')
+}
\ No newline at end of file
diff --git a/src/components/Dictionary.jsx b/src/components/Dictionary.jsx
new file mode 100644
index 0000000..afcde81
--- /dev/null
+++ b/src/components/Dictionary.jsx
@@ -0,0 +1,107 @@
+import React from 'react';
+
+import {Word} from './Word';
+import {Button} from './Button';
+
+export class Dictionary extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ name: "New",
+ description: "A new dictionary.",
+ createdBy: 'Someone',
+ words: [{
+ name: 'word',
+ pronunciation: 'pronunciation',
+ partOfSpeech: 'partOfSpeech',
+ simpleDefinition: 'simpleDefinition',
+ longDefinition: 'longDefinition',
+ wordId: 'wordId'
+ }],
+ nextWordId: 1,
+ externalID: 0,
+ allowDuplicates: false,
+ caseSensitive: false,
+ partsOfSpeech: "Noun,Adjective,Verb,Adverb,Preposition,Pronoun,Conjunction",
+ sortByEquivalent: false,
+ isComplete: false,
+ isPublic: false
+ }
+
+ // this.addTestWord();
+ }
+
+ showWords() {
+ let words = this.state.words.map((word, index) => {
+
+ });
+
+ return
{words}
;
+ }
+
+ addTestWord() {
+ this.setState({
+ words: this.state.words.concat([{
+ name: 'word',
+ pronunciation: 'pronunciation',
+ partOfSpeech: 'partOfSpeech',
+ simpleDefinition: 'simpleDefinition',
+ longDefinition: 'longDefinition',
+ wordId: 'wordId'
+ }])
+ }, () => console.log(this.state.words));
+ }
+
+ changeTestWord() {
+ this.setState(
+ words[0].name: 'cool'
+ );
+ }
+
+ render() {
+ return (
+
+
+ {this.state.name}
+
+
+
+ {this.state.createdBy}
+
+
+ Dictionary is complete: {this.state.isComplete.toString()}
+
+
+
+
+ {this.showWords()}
+
+
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/components/Header.jsx b/src/components/Header.jsx
new file mode 100644
index 0000000..0a14656
--- /dev/null
+++ b/src/components/Header.jsx
@@ -0,0 +1,89 @@
+import React from 'react';
+
+import {Button} from './Button';
+
+export class Header extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ loggedIn: false,
+ lockedOut: false
+ }
+ }
+
+ logUserIn() {
+ this.setState({
+ loggedIn: true
+ });
+ }
+
+ logUserOut() {
+ this.setState({
+ loggedIn: false
+ });
+ }
+
+ lockUserOut() {
+ this.setState({
+ loggedIn: false,
+ lockedOut: true
+ });
+ }
+
+ unlockUser() {
+ this.setState({
+ lockedOut: false
+ });
+ }
+
+ showAccountButtons() {
+ var buttons;
+
+ if (this.state.loggedIn) {
+ buttons = [
+ this.lockUserOut()}
+ label='Account Settings' />,
+ this.logUserOut()}
+ label='Log Out' />
+ ];
+ } else if (this.state.lockedOut) {
+ buttons = [
+ this.unlockUser()}
+ label='Can't Log In' />
+ ];
+ } else {
+ buttons = [
+ this.logUserIn()}
+ label='Log In/Create Account' />
+ ];
+ }
+
+ return {buttons}
;
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/components/Input.jsx b/src/components/Input.jsx
index fac0bef..20275da 100644
--- a/src/components/Input.jsx
+++ b/src/components/Input.jsx
@@ -1,5 +1,7 @@
import React from 'react';
+import {Button} from './Button';
+
export class Input extends React.Component {
constructor(props) {
super(props);
diff --git a/src/components/TextArea.jsx b/src/components/TextArea.jsx
index 28cb8e2..beb5340 100644
--- a/src/components/TextArea.jsx
+++ b/src/components/TextArea.jsx
@@ -2,6 +2,7 @@ import React from 'react';
import {Input} from './Input';
import {getInputSelection, setSelectionRange} from '../js/helpers';
+import {Button} from './Button';
export class TextArea extends Input {
constructor(props) {
@@ -34,7 +35,10 @@ export class TextArea extends Input {
diff --git a/src/components/Word.jsx b/src/components/Word.jsx
new file mode 100644
index 0000000..2d2bc23
--- /dev/null
+++ b/src/components/Word.jsx
@@ -0,0 +1,71 @@
+import React from 'react';
+
+export class Word extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ name: this.props.name,
+ wordId: this.props.wordId,
+ pronunciation: this.props.pronunciation || '',
+ partOfSpeech: this.props.partOfSpeech || '',
+ simpleDefinition: this.props.simpleDefinition || '',
+ longDefinition: this.props.longDefinition || '',
+ sortPosition: this.props.initialPosition
+ }
+ }
+
+ /*
+ {
+ name: word,
+ pronunciation: pronunciation,
+ partOfSpeech: ((partOfSpeech.length > 0) ? partOfSpeech : " "),
+ simpleDefinition: simpleDefinition,
+ longDefinition: longDefinition,
+ wordId: currentDictionary.nextWordId++
+ }
+ */
+
+ showPronunciation() {
+ if (this.state.pronunciation !== '') {
+ return {this.state.pronunciation}
;
+ }
+ }
+
+ showPartOfSpeech() {
+ if (this.state.partOfSpeech !== '') {
+ return {this.state.partOfSpeech}
;
+ }
+ }
+
+ showSimpleDefinition() {
+ if (this.state.simpleDefinition !== '') {
+ return {this.state.simpleDefinition}
;
+ }
+ }
+
+ showLongDefinition() {
+ if (this.state.longDefinition !== '') {
+ return {this.state.longDefinition}
;
+ }
+ }
+
+ render() {
+ return (
+
+
+
+ {this.state.name}
+
+ {this.showPronunciation()}
+
+ {this.showPartOfSpeech()}
+
+
+
+ {this.showSimpleDefinition()}
+ {this.showLongDefinition()}
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/index.jsx b/src/index.jsx
index 425c3f9..7be6df2 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -1,19 +1,37 @@
import './index.html';
-import './sass/styles.scss';
+import './sass/main.scss';
import React from 'react';
import ReactDOM from 'react-dom';
+import {Header} from './components/Header';
import {NewWordForm} from './components/NewWordForm';
+import {Dictionary} from './components/Dictionary';
class Lexiconga extends React.Component {
constructor(props) {
super(props);
+
+ this.state = {
+ scroll: {
+ x: 0,
+ y: 0
+ }
+ }
+
+ // this.defaultDictionaryJSON = JSON.stringify(this.state.dictionaryDetails); //Saves a stringifyed default dictionary.
+ this.previousDictionary = {};
+
+ // this.addTestWord();
}
render() {
return (
-
+
+
+
+
+
);
}
}
diff --git a/src/sass/lexiconga.scss b/src/sass/_lexiconga.scss
similarity index 96%
rename from src/sass/lexiconga.scss
rename to src/sass/_lexiconga.scss
index 679d8f4..3379803 100644
--- a/src/sass/lexiconga.scss
+++ b/src/sass/_lexiconga.scss
@@ -23,7 +23,7 @@ a {
text-indent: -9999px;
width: 242px;
height: 48px;
- background: url(../images/logo.svg);
+ // background: url(../../images/logo.svg);
background-size: 242px 48px;
float: left;
}
@@ -60,7 +60,7 @@ and (max-device-width : 480px) {
text-indent: -9999px;
width: 150px;
height: 30px;
- background: url(../images/logo.svg);
+ // background: url(../images/logo.svg);
background-size: 150px 30px;
float: left;
}
diff --git a/src/sass/mobile.scss b/src/sass/_mobile.scss
similarity index 100%
rename from src/sass/mobile.scss
rename to src/sass/_mobile.scss
diff --git a/src/sass/styles.scss b/src/sass/_styles.scss
similarity index 83%
rename from src/sass/styles.scss
rename to src/sass/_styles.scss
index 7cc1bcc..7017f3c 100644
--- a/src/sass/styles.scss
+++ b/src/sass/_styles.scss
@@ -34,6 +34,16 @@ header {
-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 {
+ float: right;
+ margin: 16px 8px;
+ font-size:12px;
+
+ span {
+ margin-left: 16px;
+ }
+ }
}
footer {
@@ -46,10 +56,10 @@ footer {
background: #aaaaaa;
padding: 0;
max-height: 32px; /* Update Dictionary Container's bottom margin to account for footer */
-}
-#footer-content {
- padding: 8px;
+ #footer-content {
+ padding: 8px;
+ }
}
table {
@@ -255,12 +265,74 @@ input[type=checkbox] {
font-style: italic;
}
-entry {
+.word {
display: block;
width: 90%;
min-width: 200px;
padding: 10px 10px 3px;
margin-bottom: 5px;
+
+ .name {
+ font-weight: bold;
+ font-size: 20px;
+ }
+
+ .pronunciation {
+ font-size: 12px;
+ margin-left:10px;
+ }
+
+ .part-of-speech {
+ font-style: italic;
+ font-weight: bold;
+ font-size: 10px;
+ margin-left:10px;
+ }
+
+ .simple-definition {
+ display: block;
+ font-style: italic;
+ }
+
+ .long-definition {
+ display: block;
+ margin-left: 20px;
+
+ h1, h2, h3, h4, h5, h6 {
+ margin: 5px 0 8px;
+ font-weight: bold;
+ }
+
+ h1 {
+ font-size: 22px;
+ }
+
+ h2 {
+ font-size: 20px;
+ }
+
+ h3 {
+ font-size: 20px;
+ font-weight: normal;
+ }
+
+ h4 {
+ font-size: 18px;
+ }
+
+ h5 {
+ font-size: 18px;
+ font-weight: normal;
+ }
+
+ h6 {
+ font-size: 17px;
+ }
+
+ p {
+ margin: 3px 0 8px;
+ }
+ }
}
.wordLink {
@@ -271,68 +343,6 @@ entry {
line-height: 10px;
}
-word {
- font-weight: bold;
- font-size: 20px;
-}
-
-pronunciation {
- font-size: 12px;
- margin-left:10px;
-}
-
-partofspeech {
- font-style: italic;
- font-weight: bold;
- font-size: 10px;
- margin-left:10px;
-}
-
-simpledefinition {
- display: block;
- font-style: italic;
-}
-
-longdefinition {
- display: block;
- margin-left: 20px;
-}
-
-longDefinition h1, longDefinition h2, longDefinition h3, longDefinition h4, longDefinition h5, longDefinition h6 {
- margin: 5px 0 8px;
- font-weight: bold;
-}
-
-longDefinition h1 {
- font-size: 22px;
-}
-
-longDefinition h2 {
- font-size: 20px;
-}
-
-longDefinition h3 {
- font-size: 20px;
- font-weight: normal;
-}
-
-longDefinition h4 {
- font-size: 18px;
-}
-
-longDefinition h5 {
- font-size: 18px;
- font-weight: normal;
-}
-
-longDefinition h6 {
- font-size: 17px;
-}
-
-longDefinition p {
- margin: 3px 0 8px;
-}
-
searchTerm {
display: inline;
color: #ff0000;
diff --git a/src/sass/main.scss b/src/sass/main.scss
index 26167f9..b2a1c6e 100644
--- a/src/sass/main.scss
+++ b/src/sass/main.scss
@@ -1,3 +1,3 @@
@import 'styles';
-// @import 'lexiconga';
-// @import 'mobile';
\ No newline at end of file
+@import 'lexiconga';
+@import 'mobile';
\ No newline at end of file