commit
d136acc13c
|
@ -1,20 +1,21 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1"
|
||||
},
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "react-scripts build",
|
||||
"start": "PORT=8000 react-scripts start"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"react": "^16.3.2",
|
||||
"react-dom": "^16.3.2",
|
||||
"react-scripts": "1.1.4"
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1"
|
||||
},
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "react-scripts build",
|
||||
"start": "node node_modules/react-scripts/scripts/start.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"react": "^16.3.2",
|
||||
"react-dom": "^16.3.2",
|
||||
"react-scripts": "1.1.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<title>Am I late ?</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -7,16 +7,24 @@ class App extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
currentOptionsState: [],
|
||||
currentOptionsState: ["test"],
|
||||
pastOptions: [],
|
||||
score: 0
|
||||
}
|
||||
}
|
||||
|
||||
_handleClick(element) {
|
||||
this.setState(prevState => ({
|
||||
pastOptions: [...prevState.pastOptions, element]
|
||||
}))
|
||||
}
|
||||
|
||||
fetchOptions() {
|
||||
axios.get('https://jsonplaceholder.typicode.com/posts/1')
|
||||
.then(((response) => {
|
||||
console.log(response)
|
||||
.then(((t) => {
|
||||
this.setState(prevState => ({
|
||||
currentOptionsState: [...prevState.currentOptionsState, t.data.title]
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -26,15 +34,15 @@ class App extends Component {
|
|||
|
||||
headerRendering() {
|
||||
|
||||
let headerPast = []
|
||||
let headerPast = [];
|
||||
|
||||
for(let i = 0; i<this.state.pastOptions-1; i++) {
|
||||
headerPast.push (
|
||||
<div className="headerPast">
|
||||
<h3 class="currentOption">
|
||||
<h3 className="currentOption">
|
||||
{this.state.pastOptions[i]}
|
||||
</h3>
|
||||
<h4 class="currentOption">
|
||||
<h4 className="currentOption">
|
||||
{this.state.pastOptions[i+1]}
|
||||
</h4>
|
||||
</div>
|
||||
|
@ -45,22 +53,24 @@ class App extends Component {
|
|||
|
||||
|
||||
render() {
|
||||
let currentOptions = this.state.currentOptionsState.map(((element) => (
|
||||
<h3 class="currentOption">
|
||||
let currentOptions = this.state.currentOptionsState.map(((element, index) => (
|
||||
<div key={index} className="currentOption btn btn-default btn-lg btn-block text-left" onClick={this._handleClick.bind(this, element)}>
|
||||
<h3 className="currentOption_element">
|
||||
{element}
|
||||
</h3>
|
||||
)))
|
||||
</div>
|
||||
)));
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<div className="App container">
|
||||
<header className="App_header">
|
||||
{this.state.pastOptions ? this.headerRendering() : null}
|
||||
|
||||
</header>
|
||||
<div className="currentSection">
|
||||
<h1 className="currentState"></h1>
|
||||
<div className="currentSection vertical-center container">
|
||||
<h1 className="currentState">{}</h1>
|
||||
<h2 className="currentQuestion">Je fais quoi ?</h2>
|
||||
<div class="currentOptions">
|
||||
<div className="currentOptions">
|
||||
{this.state.currentOptionsState ? currentOptions : null}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -162,8 +162,8 @@ api_platform:
|
|||
|
||||
# The list of enabled formats. The first one will be the default.
|
||||
formats:
|
||||
jsonld:
|
||||
mime_types: ['application/ld+json']
|
||||
# jsonld:
|
||||
# mime_types: ['application/ld+json']
|
||||
|
||||
json:
|
||||
mime_types: ['application/json']
|
||||
|
@ -178,8 +178,8 @@ api_platform:
|
|||
jsonproblem:
|
||||
mime_types: ['application/problem+json']
|
||||
|
||||
jsonld:
|
||||
mime_types: ['application/ld+json']
|
||||
# jsonld:
|
||||
# mime_types: ['application/ld+json']
|
||||
|
||||
# ...
|
||||
framework:
|
||||
|
|
2
makefile
2
makefile
|
@ -5,7 +5,7 @@ install:
|
|||
npm install;
|
||||
|
||||
api-start:
|
||||
bin/console server:start *:3000;
|
||||
bin/console server:start *:8000;
|
||||
|
||||
api-stop:
|
||||
bin/console server:stop;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1"
|
||||
},
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "react-scripts build",
|
||||
"start": "cd client && node ../node_modules/react-scripts/scripts/start.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"react": "^16.3.2",
|
||||
"react-dom": "^16.3.2",
|
||||
"react-scripts": "1.1.4"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue