Skip to content

Commit 446deb4

Browse files
committed
Added dark theme support
1 parent bafd72f commit 446deb4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/VueToggle.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<section class="wrapper" :title="title">
2+
<section class="wrapper" v-bind:class="{dark: darkTheme}" :title="title">
33
<input :id="id" :name="name" v-model="toggled" class="toggle" type="checkbox" @click="toggled = !toggled"/>
44
<label :for="id" class="toggler"/>
55
<span class="title" v-text="title" @click="toggled = !toggled"/>
@@ -15,6 +15,7 @@ export default {
1515
name: {type: [String, Boolean], default: false},
1616
title: {type: String, required: true},
1717
toggled: {type: Boolean, default: false},
18+
darkTheme: {type: Boolean, default: false}
1819
},
1920
}
2021
</script>
@@ -41,6 +42,10 @@ export default {
4142
&::selection {
4243
background: none;
4344
}
45+
46+
.dark & {
47+
color: white;
48+
}
4449
}
4550
4651
.toggle {
@@ -80,6 +85,10 @@ export default {
8085
width: 50%;
8186
will-change: left;
8287
}
88+
89+
.dark & {
90+
background: #374151;
91+
}
8392
}
8493
8594
&:checked {

0 commit comments

Comments
 (0)