getting ready for real
This commit is contained in:
@@ -8,6 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mount"><noscript>I don't like javascript, either.</noscript></div>
|
<div id="mount"><noscript>I don't like javascript, either.</noscript></div>
|
||||||
<script type="text/javascript" src="bundle.js"></script>
|
<script type="text/javascript" src="dist/bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"prettier": "prettier --write $(git ls-files \"*.ts*\")",
|
"prettier": "prettier --write $(git ls-files \"*.ts*\")",
|
||||||
"dev": "webpack-dev-server"
|
"dev": "webpack-dev-server --env dev"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
3
site.css
3
site.css
@@ -34,6 +34,9 @@ h2 {
|
|||||||
border-bottom: 1px solid #eef;
|
border-bottom: 1px solid #eef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Grid {
|
||||||
|
margin-bottom: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
.Grid-row {
|
.Grid-row {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ export interface Props {
|
|||||||
export class BigPicture extends React.PureComponent<Props, {}> {
|
export class BigPicture extends React.PureComponent<Props, {}> {
|
||||||
static displayName = "BigPicture";
|
static displayName = "BigPicture";
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
window.addEventListener("keyup", this._onEscape as any);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener("keyup", this._onEscape as any);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const src = `img/1600/${this.props.image.src}`;
|
const src = `img/1600/${this.props.image.src}`;
|
||||||
return (
|
return (
|
||||||
@@ -47,4 +55,10 @@ export class BigPicture extends React.PureComponent<Props, {}> {
|
|||||||
this.props.onClose();
|
this.props.onClose();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _onEscape = (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
this.props.onClose();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ export class Picture extends React.PureComponent<Props, {}> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (srcs.length === 0) {
|
||||||
|
return `img/1600/${this.props.image.src} 1x`;
|
||||||
|
}
|
||||||
|
|
||||||
return srcs.join(",");
|
return srcs.join(",");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env) => {
|
||||||
|
const mode = env === "dev" ? "development" : "production";
|
||||||
|
|
||||||
|
return {
|
||||||
entry: "./src/index.tsx",
|
entry: "./src/index.tsx",
|
||||||
output: {
|
output: {
|
||||||
filename: "bundle.js",
|
filename: "bundle.js",
|
||||||
path: __dirname + "/dist"
|
path: __dirname + "/dist"
|
||||||
},
|
},
|
||||||
|
|
||||||
mode: "development",
|
mode: mode,
|
||||||
|
|
||||||
// Enable sourcemaps for debugging webpack's output.
|
// Enable sourcemaps for debugging webpack's output.
|
||||||
devtool: "source-map",
|
devtool: "source-map",
|
||||||
|
|
||||||
devServer: {
|
devServer: {
|
||||||
|
publicPath: "/dist/",
|
||||||
port: 8080
|
port: 8080
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -30,4 +34,5 @@ module.exports = {
|
|||||||
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
|
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user