Merge pull request #9 from barrett-ruth/fix/mobile
color git repos properly
This commit is contained in:
commit
1867445a47
1 changed files with 21 additions and 7 deletions
|
|
@ -136,13 +136,27 @@
|
||||||
const delay = 500;
|
const delay = 500;
|
||||||
|
|
||||||
const colorFn = window.getTopicColor || (() => "");
|
const colorFn = window.getTopicColor || (() => "");
|
||||||
document.querySelectorAll("[data-topic]").forEach((t) => {
|
const topicKey = topic.split("/")[0];
|
||||||
t.classList.remove("active");
|
const willNavigateAway = !(
|
||||||
t.style.color = "";
|
isHome &&
|
||||||
});
|
topic &&
|
||||||
link.classList.add("active");
|
window.postsByCategory &&
|
||||||
const c = colorFn(topic);
|
window.postsByCategory[topic]
|
||||||
if (c) link.style.color = c;
|
);
|
||||||
|
|
||||||
|
if (willNavigateAway) {
|
||||||
|
link.classList.add("active");
|
||||||
|
const c = colorFn(topicKey);
|
||||||
|
if (c) link.style.color = c;
|
||||||
|
} else {
|
||||||
|
document.querySelectorAll("[data-topic]").forEach((t) => {
|
||||||
|
t.classList.remove("active");
|
||||||
|
t.style.color = "";
|
||||||
|
});
|
||||||
|
link.classList.add("active");
|
||||||
|
const c = colorFn(topicKey);
|
||||||
|
if (c) link.style.color = c;
|
||||||
|
}
|
||||||
|
|
||||||
const displayPath = isHome ? `/${topic}` : displayPathFromHref(href);
|
const displayPath = isHome ? `/${topic}` : displayPathFromHref(href);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue