Improve single image html

This commit is contained in:
Zed 2019-09-19 03:02:56 +02:00
parent 418168e570
commit e663b04761
2 changed files with 26 additions and 13 deletions

View File

@ -12,6 +12,7 @@
.still-image { .still-image {
width: 100%; width: 100%;
display: block;
} }
} }
@ -66,7 +67,14 @@
.single-image { .single-image {
display: inline-block; display: inline-block;
width: unset; width: 100%;
max-height: 600px;
.attachments {
width: unset;
max-height: unset;
display: inherit;
}
} }
.overlay-circle { .overlay-circle {

View File

@ -31,19 +31,24 @@ proc renderAlbum(tweet: Tweet): VNode =
let let
groups = if tweet.photos.len < 3: @[tweet.photos] groups = if tweet.photos.len < 3: @[tweet.photos]
else: tweet.photos.distribute(2) else: tweet.photos.distribute(2)
class = if groups.len == 1 and groups[0].len == 1: "single-image"
else: ""
buildHtml(tdiv(class=("attachments " & class))): if groups.len == 1 and groups[0].len == 1:
for i, photos in groups: buildHtml(tdiv(class="single-image")):
let margin = if i > 0: ".25em" else: "" tdiv(class="attachments gallery-row"):
let flex = if photos.len > 1 or groups.len > 1: "flex" else: "block" a(href=getPicUrl(groups[0][0] & "?name=orig"), class="still-image",
tdiv(class="gallery-row", style={marginTop: margin}): target="_blank"):
for photo in photos: genImg(groups[0][0])
tdiv(class="attachment image"): else:
a(href=getPicUrl(photo & "?name=orig"), class="still-image", buildHtml(tdiv(class="attachments")):
target="_blank", style={display: flex}): for i, photos in groups:
genImg(photo) let margin = if i > 0: ".25em" else: ""
let flex = if photos.len > 1 or groups.len > 1: "flex" else: "block"
tdiv(class="gallery-row", style={marginTop: margin}):
for photo in photos:
tdiv(class="attachment image"):
a(href=getPicUrl(photo & "?name=orig"), class="still-image",
target="_blank", style={display: flex}):
genImg(photo)
proc isPlaybackEnabled(prefs: Prefs; video: Video): bool = proc isPlaybackEnabled(prefs: Prefs; video: Video): bool =
case video.playbackType case video.playbackType