Commit a646fc36fe18e876109f0c6932623b8a617f6b84
1 parent
2e14b458
optimize box-shadow
use two box-shadow when focus, and a :after to make focus style looks better
Showing
1 changed file
with
46 additions
and
7 deletions
Show diff stats
src/styles/components/radio.less
@@ -178,34 +178,45 @@ span.@{radio-prefix-cls} + * { | @@ -178,34 +178,45 @@ span.@{radio-prefix-cls} + * { | ||
178 | height: @btn-circle-size; | 178 | height: @btn-circle-size; |
179 | line-height: @btn-circle-size - 2px; | 179 | line-height: @btn-circle-size - 2px; |
180 | margin: 0; | 180 | margin: 0; |
181 | - padding: 0 16px; | 181 | + padding: 0 16px - 1px; |
182 | font-size: @font-size-small; | 182 | font-size: @font-size-small; |
183 | color: @btn-default-color; | 183 | color: @btn-default-color; |
184 | transition: all @transition-time ease-in-out; | 184 | transition: all @transition-time ease-in-out; |
185 | cursor: pointer; | 185 | cursor: pointer; |
186 | border: 1px solid @border-color-base; | 186 | border: 1px solid @border-color-base; |
187 | - //border-left: 0; | 187 | + border-left: 0; |
188 | background: #fff; | 188 | background: #fff; |
189 | + position: relative; | ||
189 | 190 | ||
190 | > span { | 191 | > span { |
191 | margin-left: 0; | 192 | margin-left: 0; |
192 | } | 193 | } |
193 | 194 | ||
194 | - &:before { | 195 | + &:before, &:after { |
195 | content: ''; | 196 | content: ''; |
197 | + display: block; | ||
196 | position: absolute; | 198 | position: absolute; |
197 | width: 1px; | 199 | width: 1px; |
198 | height: 100%; | 200 | height: 100%; |
199 | left: -1px; | 201 | left: -1px; |
202 | + top: 0; | ||
200 | background: @border-color-base; | 203 | background: @border-color-base; |
201 | - visibility: hidden; | 204 | + //visibility: hidden; |
202 | transition: all @transition-time ease-in-out; | 205 | transition: all @transition-time ease-in-out; |
203 | } | 206 | } |
204 | 207 | ||
208 | + &:after{ | ||
209 | + height: @btn-circle-size + 4px; | ||
210 | + left: -1px; | ||
211 | + top: -3px; | ||
212 | + background: fade(@primary-color, 20%); | ||
213 | + opacity: 0; | ||
214 | + } | ||
215 | + | ||
205 | &:first-child { | 216 | &:first-child { |
206 | border-radius: @btn-border-radius 0 0 @btn-border-radius; | 217 | border-radius: @btn-border-radius 0 0 @btn-border-radius; |
207 | border-left: 1px solid @border-color-base; | 218 | border-left: 1px solid @border-color-base; |
208 | - &:before { | 219 | + &:before, &:after { |
209 | display: none; | 220 | display: none; |
210 | } | 221 | } |
211 | } | 222 | } |
@@ -237,11 +248,31 @@ span.@{radio-prefix-cls} + * { | @@ -237,11 +248,31 @@ span.@{radio-prefix-cls} + * { | ||
237 | background: #fff; | 248 | background: #fff; |
238 | border-color: @primary-color; | 249 | border-color: @primary-color; |
239 | color: @primary-color; | 250 | color: @primary-color; |
240 | - //box-shadow: -1px 0 0 0 @primary-color; | 251 | + box-shadow: -1px 0 0 0 @primary-color; |
252 | + z-index: 1; | ||
253 | + | ||
254 | + &:before{ | ||
255 | + background: @primary-color; | ||
256 | + opacity: 0.1; | ||
257 | + } | ||
258 | + | ||
259 | + &.@{radio-prefix-cls}-focus{ | ||
260 | + box-shadow: -1px 0 0 0 @primary-color, 0 0 0 2px fade(@primary-color, 20%); | ||
261 | + transition: all @transition-time ease-in-out; | ||
262 | + &:after{ | ||
263 | + left: -3px; | ||
264 | + top: -3px; | ||
265 | + opacity: 1; | ||
266 | + background: fade(@primary-color, 20%); | ||
267 | + } | ||
268 | + &:first-child{ | ||
269 | + box-shadow: 0 0 0 2px fade(@primary-color, 20%); | ||
270 | + } | ||
271 | + } | ||
241 | 272 | ||
242 | &:first-child { | 273 | &:first-child { |
243 | border-color: @primary-color; | 274 | border-color: @primary-color; |
244 | - //box-shadow: none!important; | 275 | + box-shadow: none; |
245 | } | 276 | } |
246 | 277 | ||
247 | &:hover { | 278 | &:hover { |
@@ -287,6 +318,9 @@ span.@{radio-prefix-cls} + * { | @@ -287,6 +318,9 @@ span.@{radio-prefix-cls} + * { | ||
287 | height: @btn-circle-size-large; | 318 | height: @btn-circle-size-large; |
288 | line-height: @btn-circle-size-large - 2px; | 319 | line-height: @btn-circle-size-large - 2px; |
289 | font-size: @font-size-base; | 320 | font-size: @font-size-base; |
321 | + &:after{ | ||
322 | + height: @btn-circle-size-large + 4px; | ||
323 | + } | ||
290 | } | 324 | } |
291 | 325 | ||
292 | .@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper{ | 326 | .@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper{ |
@@ -294,6 +328,11 @@ span.@{radio-prefix-cls} + * { | @@ -294,6 +328,11 @@ span.@{radio-prefix-cls} + * { | ||
294 | line-height: @btn-circle-size-small - 2px; | 328 | line-height: @btn-circle-size-small - 2px; |
295 | padding: 0 12px; | 329 | padding: 0 12px; |
296 | font-size: @font-size-small; | 330 | font-size: @font-size-small; |
331 | + | ||
332 | + &:after{ | ||
333 | + height: @btn-circle-size-small + 4px; | ||
334 | + } | ||
335 | + | ||
297 | &:first-child { | 336 | &:first-child { |
298 | border-radius: @btn-border-radius-small 0 0 @btn-border-radius-small; | 337 | border-radius: @btn-border-radius-small 0 0 @btn-border-radius-small; |
299 | } | 338 | } |