Skip to content

Commit

Permalink
switch black
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoYuLing committed Oct 31, 2017
1 parent 71a091b commit e08998c
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 10 deletions.
24 changes: 15 additions & 9 deletions examples/routers/switch.vue
@@ -1,24 +1,30 @@
<template>
<div>
<i-switch v-model="m1" true-value="yes" false-value="no">
<i-switch class="bsc-switch-only-text">
<span slot="open">开</span>
<span slot="close">关</span>
</i-switch>
<i-switch>
<span slot="open">开</span>
<span slot="close">关</span>
</i-switch>
<i-switch disabled>
<span slot="open">开</span>
<span slot="close">关</span>
</i-switch>
<i-switch class="bsc-switch-only-text" disabled>
<span slot="open">开</span>
<span slot="close">关</span>
</i-switch>
{{ m1 }}
<div @click="m1 = 'no'">toggle</div>
</div>
</template>
<script>
export default {
data () {
return {
m1: 'yes'
}
};
},
methods: {
change (status) {
console.log(status)
}
}
}
};
</script>
2 changes: 1 addition & 1 deletion src/styles/components/index-dark.less
Expand Up @@ -11,7 +11,7 @@
@import "notice";
@import "radio-dark";
@import "checkbox";
@import "switch";
@import "switch-dark";
@import "input-number-dark";
@import "scroll";
@import "tag-dark";
Expand Down
260 changes: 260 additions & 0 deletions src/styles/components/switch-dark.less
@@ -0,0 +1,260 @@
@switch-prefix-cls: ~"@{css-prefix}switch";
@switch-prefix-cls-only-text: ~"@{css-prefix}switch-only-text";

.@{switch-prefix-cls} {
display: inline-block;
width: 48px;
height: 24px;
line-height: 22px;
border-radius: 24px;
vertical-align: middle;
border: 1px solid #53626d;
background-color: #414d56;
position: relative;
cursor: pointer;
user-select: none;
transition: all @transition-time @ease-in-out;

&-inner {
color: #71818d;
font-size: @font-size-small;
position: absolute;
left: 25px;

i {
width: 12px;
height: 12px;
text-align: center;
}
}

&:after {
content: '';
width: 20px;
height: 20px;
border-radius: 20px;
background-color: #71818d;
position: absolute;
left: 1px;
top: 1px;
cursor: pointer;
transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
}

&:active:after {
width: 26px;
}

&:focus {
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
outline: 0;
}

&:focus:hover {
box-shadow: none;
}

&-small {
width: 24px;
height: 12px;
line-height: 10px;
&:after {
width: 10px;
height: 10px;
top: 0;
left: 0;
}
&:active:after {
width: 14px;
}
}

&-small&-checked:after {
left: 12px;
}

&-small:active&-checked:after {
left: 8px;
}

&-large{
width: 60px;
&:active:after {
width: 26px;
}
}

&-large:active:after {
width: 32px;
}

&-large&-checked:after {
left: 37px;
}

&-large:active&-checked:after {
left: 25px;
}

&-checked {
border-color: @btn-primary-bg;
background-color: @btn-primary-bg;

.@{switch-prefix-cls}-inner {
left: 8px;
color: #fff;
}

&:after {
left: 25px;
background-color: #fff;
}

&:active:after {
left: 19px;
}
}

&-disabled {
cursor: @cursor-disabled;
background: #414d56;
border-color: #53626d;

&:after {
background: #53626d;
cursor: not-allowed;
}

.@{switch-prefix-cls}-inner {
color: #53626d;
}
}
}

.@{switch-prefix-cls-only-text} {
display: inline-block;
width: 50px;
height: 26px;
line-height: 24px;
border-radius: 24px;
vertical-align: middle;
border: 2px solid #53626d;
background-color: @btn-primary-bg;
position: relative;
cursor: pointer;
user-select: none;
transition: all @transition-time @ease-in-out;

&-inner {
color: #71818d;
font-size: @font-size-small;
position: absolute;
left: 25px;

i {
width: 12px;
height: 12px;
text-align: center;
}
}

&:after {
content: '';
width: 20px;
height: 20px;
border-radius: 20px;
background-color: #71818d;
position: absolute;
left: 1px;
top: 1px;
cursor: pointer;
transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
}

&:active:after {
width: 26px;
}

&:focus {
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
outline: 0;
}

&:focus:hover {
box-shadow: none;
}

&-small {
width: 24px;
height: 12px;
line-height: 10px;
&:after {
width: 10px;
height: 10px;
top: 0;
left: 0;
}
&:active:after {
width: 14px;
}
}

&-small&-checked:after {
left: 12px;
}

&-small:active&-checked:after {
left: 8px;
}

&-large{
width: 60px;
&:active:after {
width: 26px;
}
}

&-large:active:after {
width: 32px;
}

&-large&-checked:after {
left: 37px;
}

&-large:active&-checked:after {
left: 25px;
}

&-checked {
background-color: @btn-primary-bg;

.@{switch-prefix-cls-only-text}-inner {
left: 8px;
color: #fff;
}

&:after {
left: 25px;
}

&:active:after {
left: 19px;
}
}

&-disabled {
cursor: @cursor-disabled;
background: #414d56;
border-color: #53626d;

&:after {
background: #53626d;
cursor: not-allowed;
}

.@{switch-prefix-cls-only-text}-inner {
color: #53626d;
}
}
}

0 comments on commit e08998c

Please sign in to comment.