Style tweaks
This commit is contained in:
parent
f53e99a066
commit
7a9dfd2260
|
@ -1,10 +1,12 @@
|
||||||
const React = require("react");
|
const React = require("react");
|
||||||
const prettyBytes = require("pretty-bytes");
|
const formatBytes = require("pretty-bytes");
|
||||||
const getFileContentType = require("../utils/getFileContentType");
|
const getFileContentType = require("../utils/getFileContentType");
|
||||||
|
|
||||||
const e = React.createElement;
|
const e = React.createElement;
|
||||||
|
|
||||||
const formatTime = time => new Date(time).toISOString();
|
function formatTime(time) {
|
||||||
|
return new Date(time).toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
function DirectoryListing({ dir, entries }) {
|
function DirectoryListing({ dir, entries }) {
|
||||||
const rows = entries.map(({ file, stats }, index) => {
|
const rows = entries.map(({ file, stats }, index) => {
|
||||||
|
@ -16,7 +18,7 @@ function DirectoryListing({ dir, entries }) {
|
||||||
{ key: file, className: index % 2 ? "odd" : "even" },
|
{ key: file, className: index % 2 ? "odd" : "even" },
|
||||||
e("td", null, e("a", { title: file, href }, file)),
|
e("td", null, e("a", { title: file, href }, file)),
|
||||||
e("td", null, isDir ? "-" : getFileContentType(file)),
|
e("td", null, isDir ? "-" : getFileContentType(file)),
|
||||||
e("td", null, isDir ? "-" : prettyBytes(stats.size)),
|
e("td", null, isDir ? "-" : formatBytes(stats.size)),
|
||||||
e("td", null, isDir ? "-" : formatTime(stats.mtime))
|
e("td", null, isDir ? "-" : formatTime(stats.mtime))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
body {
|
body {
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
font-family: -apple-system,
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
|
||||||
BlinkMacSystemFont,
|
Arial, sans-serif;
|
||||||
"Segoe UI",
|
line-height: 1.7;
|
||||||
Roboto,
|
|
||||||
Helvetica,
|
|
||||||
Arial,
|
|
||||||
sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
padding: 0px 10px 5px;
|
padding: 0px 10px 5px;
|
||||||
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
@ -22,7 +18,8 @@ tr.even {
|
||||||
th {
|
th {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
th, td {
|
th,
|
||||||
|
td {
|
||||||
padding: 0.25em 0.5em;
|
padding: 0.25em 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
const React = require("react");
|
const React = require("react");
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
const DirectoryListing = require("./DirectoryListing");
|
|
||||||
const readCSS = require("../utils/readCSS");
|
const readCSS = require("../utils/readCSS");
|
||||||
|
|
||||||
|
const DirectoryListing = require("./DirectoryListing");
|
||||||
|
|
||||||
const e = React.createElement;
|
const e = React.createElement;
|
||||||
|
|
||||||
const IndexPageStyle = readCSS(__dirname, "IndexPage.css");
|
const IndexPageStyle = readCSS(__dirname, "IndexPage.css");
|
||||||
const IndexPageScript = `
|
const IndexPageScript = `
|
||||||
var s = document.getElementById('version'), v = s.value
|
var s = document.getElementById('version'), v = s.value;
|
||||||
s.onchange = function () {
|
s.onchange = function () {
|
||||||
window.location.href = window.location.href.replace('@' + v, '@' + s.value)
|
window.location.href = window.location.href.replace('@' + v, '@' + s.value);
|
||||||
}
|
};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const byVersion = (a, b) => (semver.lt(a, b) ? -1 : semver.gt(a, b) ? 1 : 0);
|
function byVersion(a, b) {
|
||||||
|
return semver.lt(a, b) ? -1 : semver.gt(a, b) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
function IndexPage({ packageInfo, version, dir, entries }) {
|
function IndexPage({ packageInfo, version, dir, entries }) {
|
||||||
const versions = Object.keys(packageInfo.versions).sort(byVersion);
|
const versions = Object.keys(packageInfo.versions).sort(byVersion);
|
||||||
|
|
Loading…
Reference in New Issue