Last active
August 29, 2015 14:21
-
-
Save jdsteinbach/b7dcc70cdae3447049a3 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .arrow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ---- | |
| // Sass (v3.4.13) | |
| // Compass (v1.0.3) | |
| // ---- | |
| $arrow-directions: ( | |
| up: -45deg, | |
| right: 45deg, | |
| down: 135deg, | |
| left: 225deg | |
| ); | |
| $arrow-sizes: ( | |
| small: .6em, | |
| medium: .8em, | |
| large: 1em | |
| ); | |
| $arrow-weights: ( | |
| light: 1px, | |
| normal: 2px, | |
| heavy: 4px | |
| ); | |
| $arrow-widths: ( | |
| narrow: 10deg, | |
| normal: false, | |
| wide: -10deg | |
| ); | |
| @function validate-value($map, $key) { | |
| @if map-has-key($map, $key) { | |
| @return map-get($map, $key); | |
| } @else { | |
| @error "Sorry, #{$key} isn't a valid value."; | |
| @return false; | |
| } | |
| } | |
| @mixin arrow( | |
| $color: "currentColor", | |
| $direction:"up", | |
| $size:"medium", | |
| $weight:"normal", | |
| $width:"normal" | |
| ) { | |
| // get all values from maps | |
| $rotate: validate-value($arrow-directions, $direction); | |
| $height-width: validate-value($arrow-sizes, $size); | |
| $border-width: validate-value($arrow-weights, $weight); | |
| $skew: validate-value($arrow-widths, $width); | |
| $transform: "rotate(#{$rotate})"; | |
| @if $skew { | |
| $transform: $transform + " skewX(#{$skew}) skewY(#{$skew})" | |
| } | |
| display: inline-block; | |
| width: $height-width; | |
| height: $height-width; | |
| border: $color solid; | |
| border-width: $border-width $border-width 0 0; | |
| border-radius: 1px; | |
| transform: unquote($transform); | |
| } | |
| .arrow { | |
| @include arrow(blue, right, large, heavy); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .arrow { | |
| display: inline-block; | |
| width: 1em; | |
| height: 1em; | |
| border: blue solid; | |
| border-width: 4px 4px 0 0; | |
| border-radius: 1px; | |
| transform: rotate(45deg); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="arrow"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment