Blame view

src/styles/components/switch.less 2.33 KB
07aa688e   梁灏   add Switch UI
1
2
3
4
  @switch-prefix-cls: ~"@{css-prefix}switch";
  
  .@{switch-prefix-cls} {
      display: inline-block;
2af5843d   梁灏   Switch add large ...
5
      width: 48px;
07aa688e   梁灏   add Switch UI
6
7
      height: 24px;
      line-height: 22px;
2af5843d   梁灏   Switch add large ...
8
      border-radius: 24px;
07aa688e   梁灏   add Switch UI
9
10
11
12
13
      vertical-align: middle;
      border: 1px solid #ccc;
      background-color: #ccc;
      position: relative;
      cursor: pointer;
e2645048   jingsam   :fire: remove tra...
14
15
      user-select: none;
      transition: all @transition-time @ease-in-out;
07aa688e   梁灏   add Switch UI
16
17
18
  
      &-inner {
          color: #fff;
3c01d81a   梁灏   fixed Modal bug,w...
19
          font-size: @font-size-small;
07aa688e   梁灏   add Switch UI
20
          position: absolute;
2af5843d   梁灏   Switch add large ...
21
          left: 25px;
95436eeb   梁灏   add InputNumber UI
22
  
e2645048   jingsam   :fire: remove tra...
23
          i {
95436eeb   梁灏   add InputNumber UI
24
25
26
27
              width: 12px;
              height: 12px;
              text-align: center;
          }
07aa688e   梁灏   add Switch UI
28
29
30
31
      }
  
      &:after {
          content: '';
2af5843d   梁灏   Switch add large ...
32
33
34
          width: 20px;
          height: 20px;
          border-radius: 20px;
07aa688e   梁灏   add Switch UI
35
36
          background-color: #fff;
          position: absolute;
2af5843d   梁灏   Switch add large ...
37
38
          left: 1px;
          top: 1px;
07aa688e   梁灏   add Switch UI
39
          cursor: pointer;
e2645048   jingsam   :fire: remove tra...
40
          transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
07aa688e   梁灏   add Switch UI
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
      }
  
      &:active:after {
          width: 26px;
      }
  
      &:focus {
          box-shadow: 0 0 0 2px fade(@primary-color, 20%);
          outline: 0;
      }
  
      &:focus:hover {
          box-shadow: none;
      }
  
      &-small {
2af5843d   梁灏   Switch add large ...
57
58
59
          width: 24px;
          height: 12px;
          line-height: 10px;
07aa688e   梁灏   add Switch UI
60
          &:after {
2af5843d   梁灏   Switch add large ...
61
62
              width: 10px;
              height: 10px;
07aa688e   梁灏   add Switch UI
63
64
65
66
              top: 0;
              left: 0;
          }
          &:active:after {
2af5843d   梁灏   Switch add large ...
67
              width: 14px;
07aa688e   梁灏   add Switch UI
68
69
70
71
          }
      }
  
      &-small&-checked:after {
2af5843d   梁灏   Switch add large ...
72
          left: 12px;
07aa688e   梁灏   add Switch UI
73
74
75
      }
  
      &-small:active&-checked:after {
2af5843d   梁灏   Switch add large ...
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
          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;
07aa688e   梁灏   add Switch UI
96
97
98
99
100
101
102
      }
  
      &-checked {
          border-color: @primary-color;
          background-color: @primary-color;
  
          .@{switch-prefix-cls}-inner {
2af5843d   梁灏   Switch add large ...
103
              left: 8px;
07aa688e   梁灏   add Switch UI
104
105
106
          }
  
          &:after {
2af5843d   梁灏   Switch add large ...
107
              left: 25px;
07aa688e   梁灏   add Switch UI
108
109
110
          }
  
          &:active:after {
2af5843d   梁灏   Switch add large ...
111
              left: 19px;
07aa688e   梁灏   add Switch UI
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
          }
      }
  
      &-disabled {
          cursor: @cursor-disabled;
          background: #f3f3f3;
          border-color: #f3f3f3;
  
          &:after {
              background: #ccc;
              cursor: not-allowed;
          }
  
          .@{switch-prefix-cls}-inner {
              color: #ccc;
          }
      }
e2645048   jingsam   :fire: remove tra...
129
  }