Tidied up stylesheet structure.

This commit is contained in:
Violet Rose 2020-09-06 18:19:08 -07:00
parent dd4bd7c489
commit 99fffde0a2
2 changed files with 10 additions and 13 deletions

View File

@ -1,12 +1,16 @@
/* Thanks to Guus Lieben for the Material Design Switch */ /* Thanks to Guus Lieben for the Material Design Switch */
.switch-ctn .switch-ctn
margin: 20px 16px
position: relative position: relative
&.compact
margin: 0
.switch-input .switch-input
appearance: none appearance: none
height: 20px height: 20px
left: 13px left: -3px
position: absolute position: absolute
top: calc(50% - 3px) top: calc(50% - 3px)
-ms-transform: translate(0, (-50%)) -ms-transform: translate(0, (-50%))
@ -14,9 +18,6 @@
transform: translate(0, -50%) transform: translate(0, -50%)
width: 34px width: 34px
&.compact
left: -3px
.switch-label .switch-label
position: relative position: relative
display: inline-block display: inline-block
@ -24,12 +25,7 @@
cursor: pointer cursor: pointer
font-weight: 500 font-weight: 500
text-align: left text-align: left
margin: 16px padding: 12px 0 12px 44px
padding: 16px 0 16px 44px
&.compact
margin: 0px
padding: 12px 0 12px 44px
&:before, &:after &:before, &:after
content: "" content: ""

View File

@ -1,19 +1,20 @@
<template> <template>
<div class="switch-ctn"> <div
class="switch-ctn"
:class="{compact}"
>
<input <input
:id="id" :id="id"
v-model="currentValue" v-model="currentValue"
type="checkbox" type="checkbox"
name="set-name" name="set-name"
class="switch-input" class="switch-input"
:class="{compact}"
:checked="currentValue" :checked="currentValue"
@change="$emit('change', currentValue)" @change="$emit('change', currentValue)"
> >
<label <label
:for="id" :for="id"
class="switch-label" class="switch-label"
:class="{compact}"
> >
{{ label }} {{ label }}
</label> </label>