|
| 1 | +@mixin triangle-direction ($direction) { |
| 2 | + &::after { |
| 3 | + position: absolute; |
| 4 | + |
| 5 | + box-sizing: border-box; |
| 6 | + |
| 7 | + content: ' '; |
| 8 | + |
| 9 | + border-width: calc(#{ $borders-width-x4 } + #{ $borders-width-x1 }); |
| 10 | + border-color: transparent transparent $tooltip-background-color $tooltip-background-color; |
| 11 | + border-radius: 0 0 0 calc(#{ $borders-radius-x2 } + #{ $borders-radius-x2} / 2); |
| 12 | + |
| 13 | + @if $direction == 'up' { |
| 14 | + top: calc(-1 * (#{$spaces-x4} )); |
| 15 | + |
| 16 | + transform: rotate(135deg); |
| 17 | + } |
| 18 | + @if $direction == 'down' { |
| 19 | + bottom: calc(-1 * (#{$spaces-x4} )); |
| 20 | + |
| 21 | + transform: rotate(-45deg); |
| 22 | + } |
| 23 | + @if $direction == 'left' { |
| 24 | + top: $tooltip-arrow-position-center; |
| 25 | + left: calc(-1 * (#{$spaces-x4} )); |
| 26 | + |
| 27 | + margin-block-start: calc(-1 * #{ $spaces-x4 }); |
| 28 | + |
| 29 | + transform: rotate(45deg); |
| 30 | + } |
| 31 | + @if $direction == 'right' { |
| 32 | + top: $tooltip-arrow-position-center; |
| 33 | + right: calc(-1 * (#{$spaces-x4} )); |
| 34 | + |
| 35 | + margin-block-start: calc(-1 * #{ $spaces-x4 }); |
| 36 | + |
| 37 | + transform: rotate(-135deg); |
| 38 | + } |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +.rcx-tooltip { |
| 43 | + position: relative; |
| 44 | + |
| 45 | + display: inline-block; |
| 46 | + |
| 47 | + max-width: $spaces-x240; |
| 48 | + |
| 49 | + padding-block: $spaces-x8; |
| 50 | + padding-inline: $spaces-x12; |
| 51 | + |
| 52 | + word-break: break-all; |
| 53 | + |
| 54 | + color: $tooltip-text-color; |
| 55 | + |
| 56 | + border-radius: $borders-radius-x4; |
| 57 | + |
| 58 | + background-color: $tooltip-background-color; |
| 59 | + |
| 60 | + @include use-text-style(p2); |
| 61 | + |
| 62 | + &--dir-up { |
| 63 | + @include triangle-direction('up'); |
| 64 | + } |
| 65 | + |
| 66 | + &--dir-down { |
| 67 | + @include triangle-direction('down'); |
| 68 | + } |
| 69 | + |
| 70 | + &--dir-left { |
| 71 | + @include triangle-direction('left'); |
| 72 | + } |
| 73 | + |
| 74 | + &--dir-right { |
| 75 | + @include triangle-direction('right'); |
| 76 | + } |
| 77 | + |
| 78 | + &--pos { |
| 79 | + &-center { |
| 80 | + &::after { |
| 81 | + left: 50%; |
| 82 | + |
| 83 | + margin-inline-start: calc(-1 * #{ $spaces-x4 }); |
| 84 | + } |
| 85 | + } |
| 86 | + |
| 87 | + &-left { |
| 88 | + &::after { |
| 89 | + left: $tooltip-arrow-margin; |
| 90 | + |
| 91 | + margin: 0; |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + &-right { |
| 96 | + &::after { |
| 97 | + right: $tooltip-arrow-margin; |
| 98 | + left: initial; |
| 99 | + |
| 100 | + margin: 0; |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | +} |
0 commit comments