chore: dry up media templates

This commit is contained in:
Cory Dransfeldt 2024-05-20 10:50:46 -07:00
parent 485f640139
commit de10bfd839
No known key found for this signature in database
39 changed files with 86 additions and 243 deletions

View file

@ -0,0 +1,19 @@
<hr class="large-spacing" />
<div class="music-chart">
{% for item in data.items %}
{%- assign percentage = item.plays | calculatePlayPercentage:playTotal -%}
<div class="item">
<div class="presentation">
<div class="count">{{ item.rank | formatNumber }}.</div>
<div class="info">
<div class="title">
<a href="{{ item.url }}">{{ item.title }}</a>
</div>
<div class="subtext">{{ item.artist }} • {{ item.plays }} plays</div>
</div>
</div>
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
</div>
{% endfor %}
</div>
{% render "partials/widgets/paginator.liquid", pagination:data %}

View file

@ -0,0 +1,16 @@
<hr class="large-spacing" />
<div class="media-grid square">
{% for item in data.items %}
{% assign alt = item.alt | strip | escape %}
<a href="{{ item.url | stripUtm }}" title="{{ alt }}">
<div class="item-wrapper shadow">
<div class="meta-text">
<div class="header">{{ item.title }}</div>
<div class="subheader">{{ item.plays }} plays</div>
</div>
<img src="https://coryd.dev/.netlify/images/?url={{ item.image }}&fit=cover&w=240&h=240&fm=webp&q=80"{% if alt %} alt="{{ alt }}"{% endif %} loading="eager" decoding="async" width="240" height="240" />
</div>
</a>
{% endfor %}
</div>
{% render "partials/widgets/paginator.liquid", pagination:data %}

View file

@ -0,0 +1,21 @@
{% if albumReleases.size > 0 %}
<h2 id="album-releases" class="section-header flex-centered">
{% tablericon "calendar-time" "Anticipated albums" %}
Anticipated albums
</h2>
<ul class="link-list">
{% for album in albumReleases %}
<li>
<strong>{{ album.date }}: </strong>
<a href="{{ album.url}}" title="{{ album.title | escape}} by {{ album.artist | escape}}">
{{ album.title }}
</a>
<span> by </span>
<a href="https://musicbrainz.org/artist/{{ album.mbid }}">
{{ album.artist }}
</a>
<span> • {{ album.genre }}</span>
</li>
{% endfor %}
</ul>
{% endif %}

View file

@ -0,0 +1,19 @@
{% if data.size > 0 %}
<div class="music-chart">
{% for item in data limit: 10 %}
{%- assign percentage = item.plays | calculatePlayPercentage: mostPlayed -%}
<div class="item">
<div class="presentation">
<div class="count">{{ item.rank | formatNumber }}.</div>
<div class="info">
<div class="title">
<a href="{{ item.url }}">{{ item.title }}</a>
</div>
<div class="subtext">{{ item.artist }} • {{ item.plays }} plays</div>
</div>
</div>
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
</div>
{% endfor %}
</div>
{% endif %}

View file

@ -0,0 +1,21 @@
{% if data.size > 0 %}
<div class="music-chart">
{% for item in data limit: 10 %}
{% capture alt %}{{ item.title | escape }} by {{ item.artist }}{% endcapture %}
<div class="item">
<div class="meta">
<img src="https://coryd.dev/.netlify/images/?url={{ item.image }}&fit=cover&w=64&h=64&fm=webp&q=80" alt="{{ alt }}" loading="lazy" decoding="async" width="64" height="64" />
<div class="meta-text">
<div class="title">
<a href="{{ item.url }}">{{ item.title }}</a>
</div>
<div class="subtext">{{ item.artist }}</div>
</div>
</div>
<div class="timestamp">
{{ item.timestamp | date: "%B %-d, %-I:%M%p", "America/Los_Angeles" }}
</div>
</div>
{% endfor %}
</div>
{% endif %}