Skip to content

Instantly share code, notes, and snippets.

@c0defre4k
Created September 2, 2016 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c0defre4k/edb5dc546628237ae2ec4e34d64cb8af to your computer and use it in GitHub Desktop.
Save c0defre4k/edb5dc546628237ae2ec4e34d64cb8af to your computer and use it in GitHub Desktop.
/*
* Created on : 20.02.2014, 10:43:52
* Author : rpillichshammer
*/
/*
* main mixin for arrows
* ----------------------------
*/
@defaultArrowSize: 4px;
@defaultArrowColor: #fff;
.arrow-default-values(@size: @defaultArrowSize, @color: @defaultArrowColor) {
position: absolute;
content: "";
top: 50%;
}
.arrow(@size: @defaultArrowSize, @color: @defaultArrowColor, @direction: down) when (@direction = up) {
.arrow-default-values(@size);
border-bottom: @size solid @color;
border-right: @size solid transparent;
border-left: @size solid transparent;
margin-top: (@size - 1px) * -1;
}
.arrow(@size: @defaultArrowSize, @color: @defaultArrowColor, @direction: down) when (@direction = down) {
.arrow-default-values(@size);
border-top: @size solid @color;
border-right: @size solid transparent;
border-left: @size solid transparent;
margin-top: (@size - 1px) * -1;
}
.arrow(@size: @defaultArrowSize, @color: @defaultArrowColor, @direction: down) when (@direction = left) {
.arrow-default-values(@size);
border-right: @size solid @color;
border-top: @size solid transparent;
border-bottom: @size solid transparent;
margin-top: (@size + 1px) * -1;
}
.arrow(@size: @defaultArrowSize, @color: @defaultArrowColor, @direction: down) when (@direction = right) {
.arrow-default-values(@size);
border-left: @size solid @color;
border-top: @size solid transparent;
border-bottom: @size solid transparent;
margin-top: (@size + 1px) * -1;
}
/*
* aliases
* ----------------------------
*/
.arrow-up(@size: @defaultArrowSize, @color: @defaultArrowColor) {
.arrow(@size, @color, up);
}
.arrow-down(@size: @defaultArrowSize, @color: @defaultArrowColor) {
.arrow(@size, @color, down);
}
.arrow-left(@size: @defaultArrowSize, @color: @defaultArrowColor) {
.arrow(@size, @color, left);
}
.arrow-right(@size: @defaultArrowSize, @color: @defaultArrowColor) {
.arrow(@size, @color, right);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment