Style tweaks

This commit is contained in:
Michael Jackson 2018-04-03 22:24:22 -07:00
parent f53e99a066
commit 7a9dfd2260
3 changed files with 21 additions and 18 deletions

View File

@ -1,10 +1,12 @@
const React = require("react");
const prettyBytes = require("pretty-bytes");
const formatBytes = require("pretty-bytes");
const getFileContentType = require("../utils/getFileContentType");
const e = React.createElement;
const formatTime = time => new Date(time).toISOString();
function formatTime(time) {
return new Date(time).toISOString();
}
function DirectoryListing({ dir, entries }) {
const rows = entries.map(({ file, stats }, index) => {
@ -16,7 +18,7 @@ function DirectoryListing({ dir, entries }) {
{ key: file, className: index % 2 ? "odd" : "even" },
e("td", null, e("a", { title: file, href }, 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))
);
});

View File

@ -1,14 +1,10 @@
body {
font-size: 16px;
font-family: -apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
sans-serif;
line-height: 1.5;
font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif;
line-height: 1.7;
padding: 0px 10px 5px;
color: #000000;
}
table {
@ -22,7 +18,8 @@ tr.even {
th {
text-align: left;
}
th, td {
th,
td {
padding: 0.25em 0.5em;
}

View File

@ -1,19 +1,23 @@
const React = require("react");
const semver = require("semver");
const DirectoryListing = require("./DirectoryListing");
const readCSS = require("../utils/readCSS");
const DirectoryListing = require("./DirectoryListing");
const e = React.createElement;
const IndexPageStyle = readCSS(__dirname, "IndexPage.css");
const IndexPageScript = `
var s = document.getElementById('version'), v = s.value
var s = document.getElementById('version'), v = s.value;
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 }) {
const versions = Object.keys(packageInfo.versions).sort(byVersion);