Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Changing theme change buttons to correlate to color clicked #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ <h1>
<div class="theme">
<ul class="theme__list">
<li class="theme__item">
<button class="theme__button" value="dark" title="Enable dark theme">Dark</button>
<button class="theme__button" value="dark" title="Enable dark theme" onclick="themeChange(this)">Dark</button>
</li>
<li class="theme__item">
<button class="theme__button" value="light" title="Enable light theme">Light</button>
<button class="theme__button" value="light" title="Enable light theme" onclick="themeChange(this)">Light</button>
</li>
</ul>
</div>
Expand Down Expand Up @@ -103,7 +103,9 @@ <h1>
const style =
`font-family: Arial; font-size: ${size}px; line-height: 2em; color: #f33525; text-shadow: 0.5em 0 0 #81bc06, 0 0.5em 0 #05a6f0, 0.5em 0.5em 0 #ffba08;`;
console.log('%c■ ', style);
console.log('👋 Hi there! 👋\n\nIt seems you like to poke around as much as we do.\n\nhttps://github.com/Microsoft/join-dev-design');
console.log(
'👋 Hi there! 👋\n\nIt seems you like to poke around as much as we do.\n\nhttps://github.com/Microsoft/join-dev-design'
);
}

logLogo(100);
Expand All @@ -121,4 +123,4 @@ <h1>
</script>
</body>

</html>
</html>
6 changes: 3 additions & 3 deletions docs/theme/theme.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var $body = document.body;
var activeTheme = "dark";

document.querySelector(".theme").onclick = function(e) {
function themeChange(theme) {
$body.classList.remove("js-theme-" + activeTheme);
activeTheme = activeTheme === "dark" ? "light" : "dark";
activeTheme = theme.value === "dark" ? "dark" : "light";
$body.classList.add("js-theme-" + activeTheme);
};
}