-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53deb0f
commit e1b122e
Showing
6 changed files
with
219 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,83 @@ | ||
<template> | ||
<ul> | ||
<li v-for="(theme, i) in listOfThemes" :key="i" @click="changeTheme(theme.name)"> | ||
<span :class="{active: $store.state.theme === theme.name}" :style="`background: ${theme.color}`" /> | ||
<li | ||
v-for="(theme, i) in listOfThemes" | ||
:key="i" | ||
:class="{active: $store.state.theme === theme.name}" | ||
@click="changeTheme(theme.name)"> | ||
<img v-if="theme.image" :src="`images/${theme.image}`" alt="theme logo"> | ||
<span v-else :style="`background: ${theme.color}`" /> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import { listOfThemes } from '@/data/theme-colors' | ||
import { ThemeSwatch } from '~/types/theme' | ||
export default Vue.extend({ | ||
data() { | ||
return { | ||
listOfThemes: listOfThemes as ThemeSwatch[] | ||
} | ||
}, | ||
methods: { | ||
changeTheme(theme: string): void { | ||
this.$store.dispatch('changeTheme', theme) | ||
} | ||
import Vue from 'vue' | ||
import { listOfThemes } from '@/data/theme-colors' | ||
import { ThemeSwatch } from '~/types/theme' | ||
export default Vue.extend({ | ||
data() { | ||
return { | ||
listOfThemes: listOfThemes as ThemeSwatch[] | ||
} | ||
}, | ||
methods: { | ||
changeTheme(theme: string): void { | ||
this.$store.dispatch('changeTheme', theme) | ||
} | ||
}) | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
ul { | ||
position: absolute; | ||
left: 1rem; | ||
bottom: 3rem; | ||
display: none; | ||
width: 25px; | ||
z-index: 101; | ||
@media screen and (min-width: 1025px) { | ||
display: block; | ||
} | ||
ul { | ||
position: absolute; | ||
z-index: 101; | ||
bottom: 3rem; | ||
left: 1rem; | ||
display: none; | ||
width: 25px; | ||
li:hover { | ||
cursor: pointer; | ||
@media screen and (min-width: 1025px) { | ||
display: block; | ||
} | ||
li { | ||
width: 35px; | ||
img { | ||
width: 20px; | ||
margin: 0 auto; | ||
} | ||
li span { | ||
span { | ||
display: block; | ||
width: 15px; | ||
height: 15px; | ||
border-radius: 50%; | ||
border: 1px solid lighten(#000000, 15%); | ||
margin: 1rem auto 0 auto; | ||
transition: all .2s ease; | ||
border: 1px solid lighten(#000000, 15%); | ||
border-radius: 50%; | ||
} | ||
} | ||
li:hover { | ||
cursor: pointer; | ||
} | ||
li.active { | ||
span { | ||
width: 25px; | ||
height: 25px; | ||
transition: all .2s ease; | ||
border: 4px solid #000000; | ||
} | ||
&.active { | ||
border: 4px solid #000000; | ||
width: 25px; | ||
height: 25px; | ||
transition: all .2s ease; | ||
} | ||
img { | ||
width: 35px; | ||
height: auto; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.