mirror of
https://github.com/gmemstr/sliproad.git
synced 2024-09-20 00:21:15 +01:00
Restyled frontend with nicer colours and layout.
Got some good pointers for how to layout directories, so took the chance to add a nicer colour palette. May tweak this a little later down the line, but blue = directory, red = file.
This commit is contained in:
parent
59c79fc4fe
commit
2a17dbc178
|
@ -1,9 +1,21 @@
|
||||||
body {
|
:root {
|
||||||
font-family: sans-serif;
|
/* https://coolors.co/fe4a49-fed766-009fb7-e6e6ea-f4f4f8 */
|
||||||
color: black;
|
--orange: rgba(254, 74, 73, 1);
|
||||||
|
--yellow: rgba(254, 215, 102, 1);
|
||||||
|
--blue: rgba(0, 159, 183, 1);
|
||||||
|
--platinum: rgba(230, 230, 234, 1);
|
||||||
|
--white: rgba(244, 244, 248, 1);
|
||||||
|
|
||||||
|
--desktop-width: 1170px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-lg, .grid-sm {
|
body, h1 a {
|
||||||
|
font-family: sans-serif;
|
||||||
|
color: var(--orange);
|
||||||
|
background-color: var(--white);
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-lg {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(5, 1fr);
|
grid-template-columns: repeat(5, 1fr);
|
||||||
grid-template-rows: repeat(5, 2fr);
|
grid-template-rows: repeat(5, 2fr);
|
||||||
|
@ -15,64 +27,87 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 10vh;
|
padding: 10vh;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: black;
|
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s;
|
||||||
|
background-color: var(--blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-sm a {
|
.list {
|
||||||
|
width: 40%;
|
||||||
|
margin: 0 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 2vh;
|
flex-direction: column;
|
||||||
justify-content: center;
|
}
|
||||||
background-color: black;
|
|
||||||
|
.list a {
|
||||||
|
padding: 1.5vh;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s;
|
||||||
|
-ms-word-wrap: anywhere;
|
||||||
|
word-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list a.file {
|
||||||
|
background-color: var(--orange);
|
||||||
|
}
|
||||||
|
|
||||||
|
.list a.directory {
|
||||||
|
background-color: var(--blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-lg a:visited, .grid-lg a,
|
.grid-lg a:visited, .grid-lg a,
|
||||||
.grid-sm a:visited, .grid-sm a {
|
.list a:visited, .list a {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.grid-lg a:hover,
|
.grid-lg a:hover,
|
||||||
.grid-sm a:hover {
|
.list a.directory:hover {
|
||||||
color: white;
|
color: var(--blue);
|
||||||
background-color: darkgray;
|
background-color: var(--platinum);
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s, color 0.5s;
|
||||||
|
}
|
||||||
|
.list a.file:hover {
|
||||||
|
color: var(--orange);
|
||||||
|
background-color: var(--platinum);
|
||||||
|
transition: background-color 0.5s, color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
body { background-color: black; color: white; }
|
body { background-color: black; }
|
||||||
.grid-lg a, .grid-sm a {
|
.grid-lg a {
|
||||||
background-color: white;
|
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
.grid-lg a:visited, .grid-lg a,
|
.grid-lg a:visited, .grid-lg a {
|
||||||
.grid-sm a:visited, .grid-sm a {
|
|
||||||
color: black
|
color: black
|
||||||
}
|
}
|
||||||
.grid-lg a:hover,
|
.grid-lg a:hover {
|
||||||
.grid-sm a:hover {
|
|
||||||
color: lightgray;
|
color: lightgray;
|
||||||
background-color: darkgray;
|
background-color: darkgray;
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 700px) {
|
form {
|
||||||
.grid-lg, .grid-sm {
|
margin: 0 auto;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1170px) {
|
||||||
|
.grid-lg {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.grid-lg a, .grid-sm a {
|
.grid-lg a {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
}
|
.list, form {
|
||||||
@media only screen and (min-width: 1921px) {
|
width: 90%;
|
||||||
.grid-lg, .grid-sm {
|
}
|
||||||
grid-template-columns: repeat(5, 1fr);
|
.list a img {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,14 +121,32 @@ input[type="file"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="file"] + label {
|
input[type="file"] + label {
|
||||||
|
padding: 10px;
|
||||||
font-size: 1.25em;
|
font-size: 1.25em;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: white;
|
color: var(--desktop-width);
|
||||||
background-color: black;
|
background-color: var(--yellow);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
border: 2px solid var(--orange);
|
||||||
|
border-radius: 5px 5px 0 0;
|
||||||
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="file"]:focus + label,
|
input[type="file"]:focus + label,
|
||||||
input[type="file"] + label:hover {
|
input[type="file"] + label:hover {
|
||||||
background-color: red;
|
background-color: var(--platinum);
|
||||||
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
background: var(--platinum);
|
||||||
|
border: 1px solid var(--orange);
|
||||||
|
}
|
||||||
|
progress::-webkit-progress-bar {
|
||||||
|
background: var(--orange);
|
||||||
|
}
|
||||||
|
progress::-webkit-progress-value {
|
||||||
|
background: var(--orange);
|
||||||
|
}
|
||||||
|
progress::-moz-progress-bar {
|
||||||
|
background: var(--orange);
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@
|
||||||
<link rel="stylesheet" href="/css/styles.css">
|
<link rel="stylesheet" href="/css/styles.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>NAS</h1>
|
<h1><a href="/">NAS</a></h1>
|
||||||
|
|
||||||
<main id="main">
|
<main id="main">
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -5,21 +5,29 @@ let input = ""
|
||||||
|
|
||||||
// Fetch file listing for a provider and optional path.
|
// Fetch file listing for a provider and optional path.
|
||||||
function getFileListing(provider, path = "") {
|
function getFileListing(provider, path = "") {
|
||||||
|
// There is some funky behaviour happening here between localhost and a deployed instance.
|
||||||
|
// This *fixes* is, but it's not ideal.
|
||||||
|
if (!path.startsWith("/") && path !== "") {
|
||||||
|
path = "/" + path
|
||||||
|
}
|
||||||
fetch(`/api/files/${provider}${path}`)
|
fetch(`/api/files/${provider}${path}`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
let files = data["Files"]
|
let files = data["Files"]
|
||||||
|
if (!files) {
|
||||||
|
files = []
|
||||||
|
}
|
||||||
html`
|
html`
|
||||||
<form action="#" method="post">
|
<form action="#" method="post">
|
||||||
<input type="file" id="file" data-dir="${provider}/${path}"><label for="file">Upload</label>
|
<input type="file" id="file" data-dir="${provider}${path}"><label for="file">Upload</label>
|
||||||
</form>
|
|
||||||
<progress id="progress" value="0" max="100" hidden=""></progress>
|
<progress id="progress" value="0" max="100" hidden=""></progress>
|
||||||
<div class="grid-sm">
|
</form>
|
||||||
|
<div class="list">
|
||||||
${files.map(file =>
|
${files.map(file =>
|
||||||
`<a href="${!file.IsDirectory ? `/api/files/${provider}/${path}/${file.Name}` : `#${provider}${path === "" ? "" : "/" + path}/${file.Name}`}">
|
`<a class="${file.IsDirectory ? "directory" : "file"}" href="${!file.IsDirectory ? `/api/files/${provider}${path}/${file.Name}` : `#${provider}${path === "" ? "" : path}/${file.Name}`}">
|
||||||
${file.Name}${file.IsDirectory ? '/' : ''}
|
<span>${file.Name}${file.IsDirectory ? '/' : ''}</span>
|
||||||
</a>
|
</a>
|
||||||
`
|
`
|
||||||
).join('')}
|
).join('')}
|
||||||
|
|
Loading…
Reference in a new issue