-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be31e3b
commit e848a32
Showing
7 changed files
with
149 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": ["@babel/plugin-proposal-class-properties"] | ||
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.nav { | ||
background-color: orange; | ||
&:after { | ||
content: "kkkkkkkkkk"; | ||
color: limegreen; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,18 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import API from '../services/api'; | ||
|
||
|
||
export class Nav extends React.Component{ | ||
state = { | ||
r:{ | ||
status:0 | ||
} | ||
}; | ||
|
||
handleClick = async () => { | ||
const { response } = await API.fetchAll(); | ||
this.setState({r:response}); | ||
}; | ||
|
||
render(){ | ||
const {r} = this.state; | ||
return( | ||
<div className="nav"> | ||
{/* eslint-disable-next-line react/button-has-type */} | ||
<button onClick={this.handleClick}>click me</button> | ||
{r&&r.status} | ||
</div> | ||
); | ||
} | ||
render(){ | ||
return( | ||
<div className="nav" /> | ||
); | ||
} | ||
} | ||
|
||
const NavBar = () => ( | ||
<Nav /> | ||
); | ||
|
||
export default connect()(NavBar); | ||
export default connect(null, {})(NavBar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,75 @@ | ||
const path = require('path'); | ||
const HtmlWebPackPlugin = require('html-webpack-plugin'); | ||
const dotenv = require('dotenv'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const DotEnvPlugin = require('dotenv-webpack'); | ||
|
||
dotenv.config(); | ||
const DIR = path.join(__dirname, ''); | ||
const SRC = path.resolve(DIR, 'src'); | ||
module.exports = { | ||
entry: ['@babel/polyfill',SRC + '/index.js'], | ||
entry: ['@babel/polyfill', './src/index.js'], | ||
output: { | ||
path: path.resolve(DIR, 'dist'), | ||
filename: 'bundle.js' | ||
}, | ||
devServer: { | ||
port: process.env.PORT||3000, | ||
historyApiFallback: true, | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'bundle.js', | ||
publicPath: '/', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader' | ||
} | ||
},{ | ||
test: /\.html$/, | ||
use: { | ||
loader: 'html-loader' | ||
} | ||
rules: [{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
'sass-loader' | ||
] | ||
} | ||
}, | ||
{ | ||
test: /\.(css|scss)$/, | ||
use: [ | ||
'style-loader', // creates style nodes from JS strings | ||
'css-loader', // translates CSS into CommonJS | ||
'sass-loader', // compiles Sass to CSS, using Node Sass by default | ||
], | ||
}, | ||
{ | ||
test: /\.(gif|png|jpe?g|svg)$/i, | ||
use: [ | ||
'file-loader', | ||
{ | ||
loader: 'image-webpack-loader', | ||
options: { | ||
mozjpeg: { | ||
progressive: true, | ||
quality: 65, | ||
}, | ||
// optipng.enabled: false will disable optipng | ||
optipng: { | ||
enabled: false, | ||
}, | ||
pngquant: { | ||
quality: '65-90', | ||
speed: 4, | ||
}, | ||
gifsicle: { | ||
interlaced: false, | ||
}, | ||
// the webp option will enable WEBP | ||
webp: { | ||
quality: 75, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.jsx'] | ||
devServer: { | ||
port: process.env.PORT || 8080, | ||
contentBase: path.join(__dirname, 'src'), | ||
https: true, | ||
historyApiFallback: true, | ||
}, | ||
plugins: [ | ||
new HtmlWebPackPlugin({ | ||
new HtmlWebpackPlugin({ | ||
template: './src/index.html', | ||
filename: 'index.html' | ||
}) | ||
] | ||
}), | ||
new DotEnvPlugin({ systemvars: true }), | ||
], | ||
resolve: { | ||
extensions: ['.js', '.jsx', '.scss'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,6 +552,16 @@ | |
dependencies: | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
|
||
"@babel/plugin-transform-runtime@^7.5.0": | ||
version "7.5.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.5.0.tgz#45242c2c9281158c5f06d25beebac63e498a284e" | ||
integrity sha512-LmPIZOAgTLl+86gR9KjLXex6P/lRz1fWEjTz6V6QZMmKie51ja3tvzdwORqhHc4RWR8TcZ5pClpRWs0mlaA2ng== | ||
dependencies: | ||
"@babel/helper-module-imports" "^7.0.0" | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
resolve "^1.8.1" | ||
semver "^5.5.1" | ||
|
||
"@babel/plugin-transform-shorthand-properties@^7.2.0": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" | ||
|
@@ -1481,13 +1491,13 @@ aws4@^1.8.0: | |
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" | ||
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== | ||
|
||
axios@^0.18.0: | ||
version "0.18.0" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102" | ||
integrity sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI= | ||
axios@^0.19.0: | ||
version "0.19.0" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8" | ||
integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ== | ||
dependencies: | ||
follow-redirects "^1.3.0" | ||
is-buffer "^1.1.5" | ||
follow-redirects "1.5.10" | ||
is-buffer "^2.0.2" | ||
|
||
axobject-query@^2.0.2: | ||
version "2.0.2" | ||
|
@@ -2486,6 +2496,13 @@ [email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: | |
dependencies: | ||
ms "2.0.0" | ||
|
||
debug@=3.1.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" | ||
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== | ||
dependencies: | ||
ms "2.0.0" | ||
|
||
debug@^3.2.5, debug@^3.2.6: | ||
version "3.2.6" | ||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" | ||
|
@@ -2739,6 +2756,25 @@ domutils@^1.5.1: | |
dom-serializer "0" | ||
domelementtype "1" | ||
|
||
dotenv-defaults@^1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.0.2.tgz#441cf5f067653fca4bbdce9dd3b803f6f84c585d" | ||
integrity sha512-iXFvHtXl/hZPiFj++1hBg4lbKwGM+t/GlvELDnRtOFdjXyWP7mubkVr+eZGWG62kdsbulXAef6v/j6kiWc/xGA== | ||
dependencies: | ||
dotenv "^6.2.0" | ||
|
||
dotenv-webpack@^1.7.0: | ||
version "1.7.0" | ||
resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1" | ||
integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw== | ||
dependencies: | ||
dotenv-defaults "^1.0.2" | ||
|
||
dotenv@^6.2.0: | ||
version "6.2.0" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" | ||
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== | ||
|
||
dotenv@^8.0.0: | ||
version "8.0.0" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440" | ||
|
@@ -3495,7 +3531,14 @@ flush-write-stream@^1.0.0: | |
inherits "^2.0.3" | ||
readable-stream "^2.3.6" | ||
|
||
follow-redirects@^1.0.0, follow-redirects@^1.3.0: | ||
[email protected]: | ||
version "1.5.10" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" | ||
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== | ||
dependencies: | ||
debug "=3.1.0" | ||
|
||
follow-redirects@^1.0.0: | ||
version "1.7.0" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" | ||
integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== | ||
|
@@ -4284,6 +4327,11 @@ is-buffer@^1.1.5: | |
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" | ||
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== | ||
|
||
is-buffer@^2.0.2: | ||
version "2.0.3" | ||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" | ||
integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== | ||
|
||
is-callable@^1.1.3, is-callable@^1.1.4: | ||
version "1.1.4" | ||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" | ||
|
@@ -7115,6 +7163,13 @@ resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.5. | |
dependencies: | ||
path-parse "^1.0.6" | ||
|
||
resolve@^1.8.1: | ||
version "1.11.1" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" | ||
integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== | ||
dependencies: | ||
path-parse "^1.0.6" | ||
|
||
restore-cursor@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" | ||
|