kjelsrud.dev/src/components/Footer.astro
Sindre Kjelsrud de636d43d6
make socials show up without need for javascript
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
2024-02-22 15:14:29 +01:00

37 lines
1.6 KiB
Text

---
const today = new Date();
---
<script type="module" client:load>
const githubImage = document.getElementById('githubImage');
const spotifyImage = document.getElementById('spotifyImage');
const webringImage = document.getElementById('webringImage');
const updateImageForTheme = () => {
const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
githubImage.src = currentTheme === 'dark' ? '/socials/github_dark.svg' : '/socials/github_light.svg';
spotifyImage.src = currentTheme === 'dark' ? '/socials/spotify_dark.svg' : '/socials/spotify_light.svg';
webringImage.src = currentTheme === 'dark' ? '/socials/webring_dark.svg' : '/socials/webring_light.svg';
};
updateImageForTheme();
const themeToggle = document.getElementById('themeToggle');
if (themeToggle) {
themeToggle.addEventListener('click', updateImageForTheme);
}
</script>
<footer class="flex justify-between py-5 mt-5 footerbg">
<div>Sindre Kjelsrud &copy; {today.getFullYear()}</div>
<div class="flex gap-1">
<a href="https://github.com/SindreKjelsrud" aria-label="Link to my GitHub">
<img id="githubImage" height="30" width="30" src="/socials/github_light.svg" alt="GitHub"/>
</a>
<a href="https://open.spotify.com/user/kjelsrud!" aria-label="Link to my Spotify">
<img id="spotifyImage" height="30" width="30" src="/socials/spotify_light.svg" alt="Spotify"/>
</a>
<a href="https://webring.xxiivv.com/#sid" target="_blank" rel="noopener">
<img id="webringImage" height="30" width="30" src="/socials/webring_light.svg" alt="XXIIVV webring"/>
</a>
</div>
</footer>