Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of frontend #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.production

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Access Logs
**.log
.vscode/
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "interview-codingchallenge-fsjs",
"version": "1.0.0",
"description": "List builder",
"main": "/src/server/index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/JulioMoreno/interview-codingchallenge-fsjs.git"
},
"keywords": [],
"author": "Julio César Moreno Guillén",
"license": "ISC",
"bugs": {
"url": "https://github.com/JulioMoreno/interview-codingchallenge-fsjs/issues"
},
"homepage": "https://github.com/JulioMoreno/interview-codingchallenge-fsjs#readme",
"devDependencies": {
"jest": "^24.9.0",
"nodemon": "^1.19.4",
"supertest": "^4.0.2"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"mongoose": "^5.7.7"
}
}
23 changes: 23 additions & 0 deletions src/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
31 changes: 31 additions & 0 deletions src/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "3.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added src/client/public/favicon.ico
Binary file not shown.
63 changes: 63 additions & 0 deletions src/client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="List Builder"
content="List Builder create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
crossorigin="anonymous">
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous"
/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>List Builder</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
crossorigin="anonymous"></script>
</body>
</html>
Binary file added src/client/public/logo192.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/client/public/logo512.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/client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
2 changes: 2 additions & 0 deletions src/client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
22 changes: 22 additions & 0 deletions src/client/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #09d3ac;
}
18 changes: 18 additions & 0 deletions src/client/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, {Component} from 'react';
import Header from './components/header/header.component';
import List from './components/list/list.component';
import './App.css';

class App extends Component {
render() {
return (
<div className="container">
<Header />
<List />
</div>
);
}
}

export default App;

9 changes: 9 additions & 0 deletions src/client/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
9 changes: 9 additions & 0 deletions src/client/src/components/header/header.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.header-container{
display: flex;
justify-content: center;
margin-bottom: 15px;
}

.header-title-container{

}
16 changes: 16 additions & 0 deletions src/client/src/components/header/header.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { Component } from "react";
import "./header.component.css";

class Header extends Component {
render() {
return (
<div className="header-container">
<div className="header-title-container">
<h1>List Builder</h1>
</div>
</div>
);
}
}

export default Header;
Empty file.
23 changes: 23 additions & 0 deletions src/client/src/components/item/ItemList.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { Component } from "react";

class ItemList extends Component {
render() {
return (
<div>
<li className="list-group-item d-flex justify-content-between my-2">
<h6>{this.props.item.title}</h6>
<div className="todo-icon">
<span className="mx-2 text-success">
<i className="fas fa-pen"></i>
</span>
<span className="mx-2 text-danger">
<i className="fas fa-trash"></i>
</span>
</div>
</li>
</div>
);
}
}

export default ItemList;
26 changes: 26 additions & 0 deletions src/client/src/components/list/list.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.list-container{
margin: auto;
border: 1px solid #f2f2f2;
font-size: 14px;
width: 70%;
}
.title-list-container{
background: #f2f2f2;
border-radius: 5px;
}

.title-list-content{
text-align: center;
}

.item-list{
border: 1px solid #f2f2f2;
display: flex;
flex-direction: column;
}

.item-action{
width: 100%;
display: flex;
justify-content: space-between;
}
43 changes: 43 additions & 0 deletions src/client/src/components/list/list.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { Component } from "react";
import ItemList from '../item/ItemList.component';
import "./list.component.css";

class List extends Component {
constructor() {
super();
this.state = {
items: [{id: 1, title:"jugar"}, {id: 1, title:"oso"}]
};
}

onSubmit = event => {
event.preventDefault();
};

render() {
return (
<div className="list-container">
<div className="title-list-container">
<h1 className="title-list-content">List</h1>
</div>
<form onSubmit={this.onSubmit}>
<div className="input-group">
<div className="input-group-prepend">
<div className="input-group-text bg-primary text-white">
<i className="fas fa-book"></i>
</div>
</div>
<input type="text" className="form-control"/>
</div>
<button type="submit" className="btn btn-block btn-primary mt-3">Add Item</button>
</form>
{this.state.items.map((item, index) => (
<ItemList key={index} item={item}/>
))
}
</div>
);
}
}

export default List;
13 changes: 13 additions & 0 deletions src/client/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
Loading