Skip to content

Commit

Permalink
Добавляет информер о последнем выпуске подкаста (#339)
Browse files Browse the repository at this point in the history
* Добавляет информер о последнем выпуске подкаста

* Обновляет вёрстку

* Упрощает сетку

Co-authored-by: Vadim Makeev <[email protected]>

---------

Co-authored-by: Vadim Makeev <[email protected]>
  • Loading branch information
monochromer and pepelsbey authored Sep 29, 2023
1 parent 02bd7e5 commit ac723b8
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 271 deletions.
21 changes: 19 additions & 2 deletions src/includes/header.njk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% if page.url != '/' %}
{% set isMainPage = (page.url == '/') %}
{% if not isMainPage %}
{% set path = '/../../' %}
{% set mainLinkPath = 'href="/"' %}
{% endif %}
{% if page.url == '/' %}
{% if isMainPage %}
{% set headerMod = 'header--index' %}
{% set menuMod = 'menu--index' %}
{% set logoMod = 'logo--index' %}
Expand Down Expand Up @@ -42,4 +43,20 @@
</button>
{% include 'menu.njk' %}
</nav>
{% if isMainPage and lastPodcastEpisode %}
<a class="header__informers informer" href="/podcast/{{ lastPodcastEpisode.episode }}/">
<svg class="informer__icon" width="32" height="32" fill="currentColor" viewBox="0 0 32 32" aria-hidden="true">
<ellipse cx="16" cy="16" rx="2" ry="13"/>
<ellipse cx="16" cy="16" rx="15" ry="2"/>
<ellipse cx="22.5" cy="16" rx="1.5" ry="5"/>
<ellipse cx="9.5" cy="16" rx="1.5" ry="5"/>
</svg>
<b class="informer__meta">
{{- lastPodcastEpisode.episode -}}
</b>
<span class="informer__title">
{{ lastPodcastEpisode.title }}
</span>
</a>
{% endif %}
</header>
15 changes: 15 additions & 0 deletions src/pages/index.11tydata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
eleventyComputed: {
lastPodcastEpisode: function(data) {
const { episodes } = data.collections;

if (!episodes || episodes.length === 0) {
return;
}

const lastEpisode = episodes.at(-1);

return lastEpisode;
},
},
};
22 changes: 19 additions & 3 deletions src/styles/blocks/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
}

.header--index {
grid-template-columns: 1fr;
grid-template-rows: auto auto;
grid-template-columns: 3fr 1fr;
padding-bottom: 48px;
}
}

Expand All @@ -42,8 +44,7 @@
}

.header--index .header__logo {
order: 1;
padding: 16px 0 47px;
padding: 16px 0;
}
}

Expand All @@ -64,7 +65,22 @@
}

.header--index .header__menu {
grid-row: 1;
grid-column: 1 / -1;
padding-bottom: 13px;
border-bottom: 1px solid var(--color-grey-lighter);
}
}

@media (max-width: 735px) {
.header__informers {
margin-top: 16px;
margin-bottom: 32px;
}
}

@media (min-width: 736px) {
.header__informers {
margin-top: 18px;
}
}
Loading

0 comments on commit ac723b8

Please sign in to comment.