_radius.scss 1.4 KB
Newer Older
study夏羽's avatar
update  
study夏羽 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
@mixin radius($r,$d:null ,$important: false){
  $radius-value:map-get($uni-radius, $r) if($important, !important, null);
  // Key exists within the $uni-radius variable
  @if (map-has-key($uni-radius, $r) and  $d){
		@if $d == t {
				border-top-left-radius:$radius-value;
				border-top-right-radius:$radius-value;
		}@else if $d == r {
				border-top-right-radius:$radius-value;
				border-bottom-right-radius:$radius-value;
		}@else if $d == b {
				border-bottom-left-radius:$radius-value;
				border-bottom-right-radius:$radius-value;
		}@else if $d == l {
				border-top-left-radius:$radius-value;
				border-bottom-left-radius:$radius-value;
		}@else if $d == tl {
				border-top-left-radius:$radius-value;
		}@else if $d == tr {
				border-top-right-radius:$radius-value;
		}@else if $d == br {
				border-bottom-right-radius:$radius-value;
		}@else if $d == bl {
				border-bottom-left-radius:$radius-value;
		}
  }@else{
		border-radius:$radius-value;
  }
}

@each $key, $child in $uni-radius {
	@if($key){
		.uni-radius-#{"" + $key} {
				@include radius($key)
		}
	}@else{
		.uni-radius {
				@include radius($key)
		}
	}
}

@each $direction in t, r, b, l,tl, tr, br, bl {
	@each $key, $child in $uni-radius {
		@if($key){
			.uni-radius-#{"" + $direction}-#{"" + $key} {
				@include radius($key,$direction,false)
			}
		}@else{
			.uni-radius-#{$direction} {
				@include radius($key,$direction,false)
			}
		}
	}
}