Skip to content

Commit

Permalink
Add parameters to the caret mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
pine3ree authored and mdo committed Oct 3, 2022
1 parent ca06737 commit fffe055
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions scss/mixins/_caret.scss
Original file line number Diff line number Diff line change
@@ -1,44 +1,49 @@
// scss-docs-start caret-mixins
@mixin caret-down {
border-top: $caret-width solid;
border-right: $caret-width solid transparent;
@mixin caret-down($width: $caret-width) {
border-top: $width solid;
border-right: $width solid transparent;
border-bottom: 0;
border-left: $caret-width solid transparent;
border-left: $width solid transparent;
}

@mixin caret-up {
@mixin caret-up($width: $caret-width) {
border-top: 0;
border-right: $caret-width solid transparent;
border-bottom: $caret-width solid;
border-left: $caret-width solid transparent;
border-right: $width solid transparent;
border-bottom: $width solid;
border-left: $width solid transparent;
}

@mixin caret-end {
border-top: $caret-width solid transparent;
@mixin caret-end($width: $caret-width) {
border-top: $width solid transparent;
border-right: 0;
border-bottom: $caret-width solid transparent;
border-left: $caret-width solid;
border-bottom: $width solid transparent;
border-left: $width solid;
}

@mixin caret-start {
border-top: $caret-width solid transparent;
border-right: $caret-width solid;
border-bottom: $caret-width solid transparent;
@mixin caret-start($width: $caret-width) {
border-top: $width solid transparent;
border-right: $width solid;
border-bottom: $width solid transparent;
}

@mixin caret($direction: down) {
@mixin caret(
$direction: down,
$width: $caret-width,
$spacing: $caret-spacing,
$vertical-align: $caret-vertical-align
) {
@if $enable-caret {
&::after {
display: inline-block;
margin-left: $caret-spacing;
vertical-align: $caret-vertical-align;
margin-left: $spacing;
vertical-align: $vertical-align;
content: "";
@if $direction == down {
@include caret-down();
@include caret-down($width);
} @else if $direction == up {
@include caret-up();
@include caret-up($width);
} @else if $direction == end {
@include caret-end();
@include caret-end($width);
}
}

Expand All @@ -49,10 +54,10 @@

&::before {
display: inline-block;
margin-right: $caret-spacing;
vertical-align: $caret-vertical-align;
margin-right: $spacing;
vertical-align: $vertical-align;
content: "";
@include caret-start();
@include caret-start($width);
}
}

Expand Down

0 comments on commit fffe055

Please sign in to comment.