Improved lyrics view

This commit is contained in:
Eduard Urbach 2018-04-13 13:39:03 +02:00
parent b1bc006a0c
commit 7860a54406
3 changed files with 39 additions and 19 deletions

View File

@ -1,28 +1,31 @@
component SoundTrackLyricsPage(track *arn.SoundTrack, user *arn.User) component SoundTrackLyricsPage(track *arn.SoundTrack, user *arn.User)
SoundTrackTabs(track, user) SoundTrackTabs(track, user)
.soundtrack-full-page if track.Title.ByUser(user) == ""
if track.Title.ByUser(user) == "" h1.mountable untitled
h1.mountable untitled else
else h1.mountable= track.Title.ByUser(user)
h1.mountable= track.Title.ByUser(user)
.soundtrack-lyrics
.widget-form
if !track.HasLyrics() if !track.HasLyrics()
p.no-data.mountable No lyrics available for this track. p.no-data.mountable No lyrics available for this track.
else else
if track.Lyrics.Romaji != ""
.widget
h3.widget-title.mountable Romaji
RenderLyrics(track.Lyrics.Romaji)
if track.Lyrics.Native != "" if track.Lyrics.Native != ""
.widget .lyrics-column
h3.widget-title.mountable Native h3.widget-title.mountable(data-mountable-type="native") Native
RenderLyrics(track.Lyrics.Native) RenderLyrics(track.Lyrics.Native, "native")
if track.Lyrics.Romaji != ""
.lyrics-column
h3.widget-title.mountable(data-mountable-type="romaji") Romaji
RenderLyrics(track.Lyrics.Romaji, "romaji")
component RenderLyrics(text string) component RenderLyrics(text string, mountType string)
each paragraph in strings.Split(text, "\n\n") each paragraph in strings.Split(text, "\n\n")
p.lyrics-paragraph.mountable p.lyrics-paragraph
each line in strings.Split(paragraph, "\n") each line in strings.Split(paragraph, "\n")
span.lyrics-line= line if mountType == "native"
.lyrics-line.mountable(data-mountable-type=mountType)
Japanese(line)
else
.lyrics-line.mountable(data-mountable-type=mountType)= line

View File

@ -1,2 +1,16 @@
.soundtrack-lyrics
horizontal-wrap
justify-content center
.lyrics-column
flex 1
max-width 500px
padding calc(content-padding / 2)
.lyrics-paragraph
margin 1rem 0
.lyrics-line .lyrics-line
display block border-radius ui-element-border-radius
padding 0 0.25rem
height 1.9rem

View File

@ -39,6 +39,9 @@ img
backface-visibility hidden backface-visibility hidden
color transparent color transparent
rt
user-select none
.hidden .hidden
display none !important display none !important