Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"presets": ["react"]
}
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules/*
**/vendor/*
**/*.min.js
**/coverage/*
**/build/*
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"quotes": [ "error", "single" ],
"semi": ["error", "always"],
"linebreak-style": [ "error", "unix" ]
},
"env": {
"es6": true,
"node": true,
"mocha": true,
"jasmine": true
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"impliedStrict": true
},
"extends": "eslint:recommended"
}
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Created by https://www.gitignore.io/api/osx,vim,node,macos,windows

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### OSX ###

# Icon must end with two \r

# Thumbnails

# Files that might appear in the root of a volume

# Directories potentially created on remote AFP share

### Vim ###
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/osx,vim,node,macos,windows
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "23-components_and_routing",
"version": "1.0.0",
"description": "![cf](https://i.imgur.com/7v5ASc8.png) 23: Components and Routing ======",
"main": "index.js",
"scripts": {
"build": "webpack",
"watch": "webpack-dev-server --inline --hot"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Jamesbillard12/23-components_and_routing.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Jamesbillard12/23-components_and_routing/issues"
},
"homepage": "https://github.com/Jamesbillard12/23-components_and_routing#readme",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"node-sass": "^4.5.3",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-router-dom": "^4.1.2",
"sass-loader": "^6.0.6",
"url-loader": "^0.5.9",
"uuid": "^3.1.0",
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1"
}
}
31 changes: 31 additions & 0 deletions src/component/dashboard-container/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import uuid from 'uuid/v1';

import NoteCreateForm from '../note-create-form';

class DashboardContainer extends React.Component {
constructor(props) {
super(props)
this.noteCreate = this.noteCreate.bind(this);
}

noteCreate(note) {
note.id = uuid();
this.props.getNote.setState(state => ({
notesArr: [...state.notesArr, note]
}));
}

render() {
return (
<div>
<NoteCreateForm
handleSubmit={this.noteCreate}
submitTitle='Submit Note'
/>
</div>
)
}
}

export default DashboardContainer;
Binary file added src/component/navbar/assets/cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/component/navbar/assets/unicorn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/component/navbar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import './style/style.scss';

import React from 'react';
import {Link} from 'react-router-dom';


class Navbar extends React.Component {
render() {
return (
<header>
<section className="title">
<img className="unicornimg" src="src/component/navbar/assets/unicorn.png"></img>
<h1 className="titleName">Unicornotes</h1>
</section>
<nav>
<ul>

</ul>
</nav>
</header>
)
}
}

export default Navbar
11 changes: 11 additions & 0 deletions src/component/navbar/style/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import "src/style/theme/vars.scss";

.title{
background-color: $brand-primary;
border-bottom: 1em solid $brand-tertiery;
background-image: url('../assets/cloud.png');
}

.unicornimg{
width: 10em;
}
Binary file added src/component/note-create-form/assets/cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/component/note-create-form/assets/sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions src/component/note-create-form/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import './style/style.scss';


import React from 'react';

class NoteCreateForm extends React.Component {
constructor(props) {
super(props);

let title = props.noteUpdate ? props.noteUpdate.title : '';
let content = props.noteUpdate ? props.noteUpdate.content : '';

this.state ={
title,
editing: false,
completed: false,
content
}
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}

handleChange(e) {
this.setState({
[e.target.name]: e.target.value
})
}

handleSubmit(e) {
e.preventDefault();
if(this.props.submitTitle == 'Update Note') {
this.props.handleSubmit(this.state, this.props.noteUpdate.id);
}else{
this.props.handleSubmit(this.state);
}
}

render() {
return (
<form onSubmit = {this.handleSubmit}>
<div className='inputContainer'>
<input
name='title'
type='text'
value={this.state.title}
placeholder='Note Title'
onChange={this.handleChange}
/>
<span className="underline"></span>
</div>
<div className='inputContainer'>
<input
name='content'
type='text'
value={this.state.content}
placeholder='Enter Note'
onChange={this.handleChange}
/>
<span className="underline"></span>
</div>
<div className='buttonContainer'>
<button className='button' type='submit'>{this.props.submitTitle}</button>
</div>
</form>
)
}
}

export default NoteCreateForm;
Loading