Files
seasoned/src/components/ui/darkmodeToggle.vue
Kevin Midboe d1cbbfffd8 Fixes broken functions and bugs
- Mobile can now click behind movie popup to dismiss
- Link to /activity instead of /profile?activity=true
- Remove fill from icons that color using stroke
- Add border to navigation icons
- Darkmode now toggles correctly when load in light/default mode.
- Only show load previous button when loading is false
- Switched to new SearchPage over Search.vue
2022-01-10 18:33:16 +01:00

53 lines
1022 B
Vue

<template>
<div class="darkToggle">
<span @click="toggleDarkmode">{{ darkmodeToggleIcon }}</span>
</div>
</template>
<script>
export default {
data() {
return {
darkmode: this.supported()
};
},
methods: {
toggleDarkmode() {
this.darkmode = !this.darkmode;
document.body.className = this.darkmode ? "dark" : "light";
},
supported() {
const computedStyle = window.getComputedStyle(document.body);
if (computedStyle["colorScheme"] != null) {
return computedStyle.colorScheme.includes("dark");
}
return false;
}
},
computed: {
darkmodeToggleIcon() {
return this.darkmode ? "🌝" : "🌚";
}
}
};
</script>
<style lang="scss" scoped>
.darkToggle {
height: 25px;
width: 25px;
cursor: pointer;
position: fixed;
margin-bottom: 1.5rem;
margin-right: 2px;
bottom: 0;
right: 0;
z-index: 10;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>