diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-02-27 19:10:26 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-02-27 19:10:26 +0000 |
commit | bbc7ef78f6da7de1e0b7d3a93d2bd547ea30ec21 (patch) | |
tree | b802237657e90570bdd0843a6560c664e594c84c /src/renderer.rs | |
parent | Improved parent directory link's style (diff) | |
download | miniserve-bbc7ef78f6da7de1e0b7d3a93d2bd547ea30ec21.tar.gz miniserve-bbc7ef78f6da7de1e0b7d3a93d2bd547ea30ec21.zip |
Improved readability on mobile + terminal browsers
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 3fb992e..7128be4 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -79,6 +79,11 @@ fn build_link( } } +/// Partial: new line +fn br() -> Markup { + (PreEscaped("<br>".to_string())) +} + /// Partial: chevron left fn chevron_left() -> Markup { (PreEscaped("◂".to_string())) @@ -113,13 +118,15 @@ fn entry_row(entry: listing::Entry) -> Markup { html! { tr { td { - @if entry.is_dir() { - a.directory href=(entry.link) { - (entry.name) "/" - } - } @else { - a.file href=(entry.link) { - (entry.name) + p { + @if entry.is_dir() { + a.directory href=(entry.link) { + (entry.name) "/" + } + } @else { + a.file href=(entry.link) { + (entry.name) + } } } @if !entry.is_dir() { @@ -127,6 +134,7 @@ fn entry_row(entry: listing::Entry) -> Markup { span .mobile-info { strong { "Size: " } (size) + (br()) } } } @@ -138,6 +146,7 @@ fn entry_row(entry: listing::Entry) -> Markup { } @if let Some(modification_timer) = humanize_systemtime(entry.last_modification_date) { span .history { "(" (modification_timer) ")" } + (br()) } } @@ -150,10 +159,10 @@ fn entry_row(entry: listing::Entry) -> Markup { td.date-cell { @if let Some(modification_date) = convert_to_utc(entry.last_modification_date) { span { - (modification_date.0) + (modification_date.0) " " } span { - (modification_date.1) + (modification_date.1) " " } } @if let Some(modification_timer) = humanize_systemtime(entry.last_modification_date) { @@ -176,6 +185,10 @@ fn css() -> Markup { color: #444444; padding: 0.125rem; } + p { + margin: 0; + padding: 0; + } table { margin-top: 2rem; width: 100%; @@ -259,7 +272,7 @@ fn css() -> Markup { display: block; } .file, .directory{ - padding-bottom: 0.5rem; + padding-bottom: 1rem; } } @media (max-width: 400px) { |