Compare commits
No commits in common. "e90920ce861f5213618d28bae073d56c52b5ce43" and "1cce3ddc8980c18c2bf023c050df936c66d444fd" have entirely different histories.
e90920ce86
...
1cce3ddc89
2 changed files with 31 additions and 7 deletions
10
css/site.css
10
css/site.css
|
|
@ -30,7 +30,7 @@ body.custom-background { background-color: #ffffff; }
|
||||||
|
|
||||||
.speech-filters {
|
.speech-filters {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(150px, 1fr)) auto;
|
grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
margin: 0 0 18px;
|
margin: 0 0 18px;
|
||||||
|
|
@ -100,16 +100,18 @@ body.custom-background { background-color: #ffffff; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.speech-result p {
|
.speech-result p {
|
||||||
margin: 0;
|
margin: 0 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.speech-result-meta {
|
.speech-result-meta,
|
||||||
|
.speech-result-categories {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.speech-result-meta span {
|
.speech-result-meta span,
|
||||||
|
.speech-result-categories span {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,12 @@ import { getSpeechArchive, uniqueSorted } from "../../lib/speeches";
|
||||||
const speeches = getSpeechArchive();
|
const speeches = getSpeechArchive();
|
||||||
const years = uniqueSorted(speeches.map((speech) => speech.year), "desc");
|
const years = uniqueSorted(speeches.map((speech) => speech.year), "desc");
|
||||||
const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
|
const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.length ? speech.categories : [speech.category]));
|
||||||
---
|
---
|
||||||
|
|
||||||
<SiteLayout
|
<SiteLayout
|
||||||
title="Speeches Archive – FFWPU Ireland"
|
title="Speeches Archive – FFWPU Ireland"
|
||||||
description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, and text."
|
description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, category, and text."
|
||||||
bodyClass="page-template page-template-templates page-template-template-onecolumn page-template-templatestemplate-onecolumn-php page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
|
bodyClass="page-template page-template-templates page-template-template-onecolumn page-template-templatestemplate-onecolumn-php page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
|
||||||
pathname="/speeches/"
|
pathname="/speeches/"
|
||||||
canonical="/speeches/"
|
canonical="/speeches/"
|
||||||
|
|
@ -46,6 +47,14 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="speech-filter">
|
||||||
|
<label for="speech-category">Category</label>
|
||||||
|
<select id="speech-category" name="category">
|
||||||
|
<option value="">All categories</option>
|
||||||
|
{categories.map((category) => <option value={category}>{category}</option>)}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="speech-reset" type="reset">Reset filters</button>
|
<button class="speech-reset" type="reset">Reset filters</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
@ -65,6 +74,9 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
<a href={speech.url}>{speech.title}</a>
|
<a href={speech.url}>{speech.title}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<p>{speech.excerpt}</p>
|
<p>{speech.excerpt}</p>
|
||||||
|
<div class="speech-result-categories">
|
||||||
|
{(speech.categories.length ? speech.categories : [speech.category]).map((category) => <span>{category}</span>)}
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -86,8 +98,9 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
const searchInput = document.getElementById("speech-search");
|
const searchInput = document.getElementById("speech-search");
|
||||||
const yearSelect = document.getElementById("speech-year");
|
const yearSelect = document.getElementById("speech-year");
|
||||||
const speakerSelect = document.getElementById("speech-speaker");
|
const speakerSelect = document.getElementById("speech-speaker");
|
||||||
|
const categorySelect = document.getElementById("speech-category");
|
||||||
|
|
||||||
if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect) {
|
if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect || !categorySelect) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,6 +120,7 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
q: searchInput.value.trim(),
|
q: searchInput.value.trim(),
|
||||||
year: yearSelect.value,
|
year: yearSelect.value,
|
||||||
speaker: speakerSelect.value,
|
speaker: speakerSelect.value,
|
||||||
|
category: categorySelect.value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,6 +141,7 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
searchInput.value = params.get("q") || "";
|
searchInput.value = params.get("q") || "";
|
||||||
yearSelect.value = params.get("year") || "";
|
yearSelect.value = params.get("year") || "";
|
||||||
speakerSelect.value = params.get("speaker") || "";
|
speakerSelect.value = params.get("speaker") || "";
|
||||||
|
categorySelect.value = params.get("category") || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function matchesSpeech(speech, filters) {
|
function matchesSpeech(speech, filters) {
|
||||||
|
|
@ -136,6 +151,9 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
if (filters.speaker && speech.speaker !== filters.speaker) {
|
if (filters.speaker && speech.speaker !== filters.speaker) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (filters.category && !speech.categories.includes(filters.category) && speech.category !== filters.category) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!filters.q) {
|
if (!filters.q) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +188,11 @@ const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
|
||||||
const excerpt = document.createElement("p");
|
const excerpt = document.createElement("p");
|
||||||
excerpt.textContent = speech.excerpt;
|
excerpt.textContent = speech.excerpt;
|
||||||
|
|
||||||
article.append(meta, title, excerpt);
|
const categories = document.createElement("div");
|
||||||
|
categories.className = "speech-result-categories";
|
||||||
|
appendMeta(categories, speech.categories.length ? speech.categories : [speech.category]);
|
||||||
|
|
||||||
|
article.append(meta, title, excerpt, categories);
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue