UNPKG

1.95 kBSCSSView Raw
1@mixin str-truncated($max-width: 82%) {
2 display: inline-block;
3 overflow: hidden;
4 text-overflow: ellipsis;
5 vertical-align: top;
6 white-space: nowrap;
7 max-width: $max-width;
8}
9
10@mixin gl-fluid-font-size($min, $max) {
11 @include gl-responsive-property('font-size', $min, $max);
12}
13
14@mixin gl-fluid-line-height($min, $max) {
15 @include gl-responsive-property('line-height', $min, $max);
16}
17
18/**
19* Declares a property with a fluid value that decreases or
20* rises depending on the viewport’s size. The property type
21* should be numeric.
22*
23* Values are expected in rem units.
24*
25* @param $property Property name, i.e. line-height, font-size, width, height, etc.
26* @param $property-min Property value lower bound.
27* @param $property-max Property value upper bound.
28*/
29@mixin gl-responsive-property(
30 $property,
31 $property-min,
32 $property-max,
33 $breakpoint-min: $breakpoint-md,
34 $breakpoint-max: $breakpoint-xl
35) {
36 $breakpoint-range: ($breakpoint-max - $breakpoint-min) / 1rem;
37 $property-range: ($property-max - $property-min) / 1rem;
38
39 @media (min-width: $breakpoint-min) {
40 #{$property}: calc(
41 #{$property-min} + #{$property-range} * ((100vw - #{$breakpoint-min}) / #{$breakpoint-range})
42 );
43 }
44
45 @media (min-width: $breakpoint-max) {
46 #{$property}: $property-max;
47 }
48}
49
50@mixin gl-focus($size: null, $color: false, $important: false, $inset: false) {
51 @if $inset == true {
52 @if $color {
53 box-shadow: inset 0 0 0 $size $color, $focus-ring-inset if-important($important);
54 outline: none if-important($important);
55 } @else {
56 box-shadow: $focus-ring-inset if-important($important);
57 outline: none if-important($important);
58 }
59 } @else if $color {
60 box-shadow: inset 0 0 0 $size $color, $focus-ring if-important($important);
61 outline: none if-important($important);
62 } @else {
63 box-shadow: $focus-ring if-important($important);
64 outline: none if-important($important);
65 }
66}