lyrics

lyrics
git clone git://brookjeynes.dev/bjeynes/lyrics.git
Log | Files | Refs

artist.templ (2566B)


      1 package artist
      2 
      3 import (
      4 	"lyrics/internal/server/routes"
      5 	"lyrics/internal/server/ui/layouts/base"
      6 	"time"
      7 )
      8 
      9 templ Artist(params ArtistParams) {
     10 	@base.Base(base.BaseParams{Title: params.Artist.Name, PageStylesheets: []string{"artist.css"}}) {
     11 		<article>
     12 			<header>
     13 				<hgroup>
     14 					<h1>
     15 						{ params.Artist.Name }
     16 						if params.Artist.LatinName != nil {
     17 							<span>({ *params.Artist.LatinName })</span>
     18 						}
     19 					</h1>
     20 					if params.Artist.Disambiguation != nil {
     21 						<p class="section-label -muted">{ *params.Artist.Disambiguation }</p>
     22 					}
     23 				</hgroup>
     24 				if params.Artist.Bio != nil {
     25 					<p>{ *params.Artist.Bio }</p>
     26 				}
     27 			</header>
     28 			<section>
     29 				<h2>Discography</h2>
     30 				<ol>
     31 					for _, release := range params.Releases {
     32 						<li>
     33 							<article>
     34 								<header class="release-title">
     35 									<h3>
     36 										<a href={ routes.Release(release) }>
     37 											{ release.Title }
     38 											if release.LatinTitle != nil {
     39 												<span>({ *release.LatinTitle })</span>
     40 											}
     41 										</a>
     42 									</h3>
     43 									<div>
     44 										<span>{ release.Type }</span>
     45 										ยท
     46 										<time aria-label="Release date" datetime={ release.ReleaseDate.Format(time.DateOnly) }>
     47 											{ release.ReleaseDate.Format("Jan 2, 2006") }
     48 										</time>
     49 									</div>
     50 								</header>
     51 								<section aria-label="Track List">
     52 									<ol>
     53 										for _, as := range release.Songs {
     54 											<li>
     55 												<a href={ routes.Song(as.Song) }>
     56 													{ as.Song.Title }
     57 													if as.Song.LatinTitle != nil {
     58 														<span>({ *as.Song.LatinTitle })</span>
     59 													}
     60 												</a>
     61 											</li>
     62 										}
     63 									</ol>
     64 								</section>
     65 							</article>
     66 						</li>
     67 					}
     68 				</ol>
     69 			</section>
     70 			<section aria-label="Songs">
     71 				<h2>Songs</h2>
     72 				<ul>
     73 					for _, song := range params.Singles {
     74 						<li>
     75 							<a href={ routes.Song(song) }>
     76 								{ song.Title }
     77 								if song.LatinTitle != nil {
     78 									<span>({ *song.LatinTitle })</span>
     79 								}
     80 							</a>
     81 						</li>
     82 					}
     83 				</ul>
     84 			</section>
     85 			<section aria-label="Featured On">
     86 				<h2>Featured On</h2>
     87 				<ul>
     88 					for _, song := range params.Featured {
     89 						<li>
     90 							<a href={ routes.Song(song) }>
     91 								{ song.Title }
     92 								if song.LatinTitle != nil {
     93 									<span>({ *song.LatinTitle })</span>
     94 								}
     95 							</a>
     96 						</li>
     97 					}
     98 				</ul>
     99 			</section>
    100 			<footer aria-label="Release actions">
    101 				<a href={ routes.ArtistEdit(params.Artist) }>edit artist</a>
    102 			</footer>
    103 		</article>
    104 	}
    105 }