Skip to content

Commit

Permalink
try to add tag filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Not-A-Normal-Robot committed Apr 28, 2024
1 parent 52ca67f commit 1b85dea
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
10 changes: 9 additions & 1 deletion .github/scripts/generate_faq_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ def tags_html(entry):
tags_html += tags_map[tag]
return tags_html

def tags_in_class(entry):
tags = entry['tags']
tags_classes = ""
for tag in tags:
if tag in tags_map:
tags_classes += tag + " "
return tags_classes

def faq_html(entry):
return f"""
<details class="question" name="faq">
<details class="question {tags_in_class(entry)}" name="faq">
<summary>
{entry['question']}
<span class="tags">
Expand Down
4 changes: 1 addition & 3 deletions data/faq-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ <h1 class="center-text">
</h1>
<h4 class="center-text">
Sourced from Techmino's official Discord server. <br>
Click on a question to reveal the answer. <br>
Use Ctrl+F to search for a question. <br>
Or if you're on mobile, use your browser's "find in page" feature.
Use your browser's "find in page" feature (Ctrl+F) to search for keywords.
</h4>
<h5 class="center-text" id="last-updated"></h5>
<br>
Expand Down
26 changes: 23 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,29 @@ details.question > summary::marker {
--tag-logo: "󰂖"; /* console icon */
}
/* #endregion */
/* #region Question tag filters */
.faq.show-techmino details.question:not(.techmino),
.faq.show-galaxy details.question:not(.galaxy),
.faq.show-linux details.question:not(.linux),
.faq.show-apple details.question:not(.apple),
.faq.show-multiplayer details.question:not(.multiplayer),
.faq.show-error details.question:not(.error),
.faq.show-bot details.question:not(.bot)
{
display: none;
}

.faq.hide-techmino details.question.techmino,
.faq.hide-galaxy details.question.galaxy,
.faq.hide-linux details.question.linux,
.faq.hide-apple details.question.apple,
.faq.hide-multiplayer details.question.multiplayer,
.faq.hide-error details.question.error,
.faq.hide-bot details.question.bot
{
display: none;
}
/* #end */

details.question[open] > summary {
border-bottom: 1px solid lime;
Expand All @@ -207,9 +230,6 @@ details.question[open] > summary {
details.question[open] article {
padding: 0.5rem 1rem;
}
details.question[open] {
display: block;
}
details.question[open] img {
max-width: 100%;
height: auto;
Expand Down

0 comments on commit 1b85dea

Please sign in to comment.