tooltip-v2.scss 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @include b(tooltip-v2) {
  5. @include e(content) {
  6. --#{$namespace}-tooltip-v2-padding: 5px 10px;
  7. --#{$namespace}-tooltip-v2-border-radius: 4px;
  8. @include css-var-from-global(
  9. ('tooltip-v2', 'border-color'),
  10. ('border-color')
  11. );
  12. border-radius: getCssVar('tooltip-v2-border-radius');
  13. color: getCssVar('color-black');
  14. background-color: getCssVar('color-white');
  15. padding: getCssVar('tooltip-v2-padding');
  16. border: 1px solid getCssVar('border-color');
  17. $content-selector: &;
  18. $sides: (
  19. 'top': 'bottom',
  20. 'bottom': 'top',
  21. 'left': 'right',
  22. 'right': 'left',
  23. );
  24. @include e(arrow) {
  25. position: absolute;
  26. color: getCssVar('color-white');
  27. width: var(--#{$namespace}-tooltip-v2-arrow-width);
  28. height: var(--#{$namespace}-tooltip-v2-arrow-height);
  29. pointer-events: none;
  30. left: var(--#{$namespace}-tooltip-v2-arrow-x);
  31. top: var(--#{$namespace}-tooltip-v2-arrow-y);
  32. &::before {
  33. content: '';
  34. width: 0;
  35. height: 0;
  36. border: var(--#{$namespace}-tooltip-v2-arrow-border-width) solid
  37. transparent;
  38. position: absolute;
  39. }
  40. &::after {
  41. content: '';
  42. width: 0;
  43. height: 0;
  44. border: var(--#{$namespace}-tooltip-v2-arrow-border-width) solid
  45. transparent;
  46. position: absolute;
  47. }
  48. @each $side, $opposite in $sides {
  49. #{$content-selector}[data-side^='#{$side}'] & {
  50. #{$opposite}: 0;
  51. }
  52. #{$content-selector}[data-side^='#{$side}'] &::before {
  53. border-#{$side}-color: var(--#{$namespace}-color-white);
  54. border-#{$side}-width: var(
  55. --#{$namespace}-tooltip-v2-arrow-border-width
  56. );
  57. border-#{$opposite}: 0;
  58. #{$side}: calc(100% - 1px);
  59. }
  60. #{$content-selector}[data-side^='#{$side}'] &::after {
  61. border-#{$side}-color: var(--#{$namespace}-border-color);
  62. border-#{$side}-width: var(
  63. --#{$namespace}-tooltip-v2-arrow-border-width
  64. );
  65. border-#{$opposite}: 0;
  66. #{$side}: 100%;
  67. z-index: -1;
  68. }
  69. }
  70. }
  71. &.is-dark {
  72. --#{$namespace}-tooltip-v2-border-color: transparent;
  73. background-color: getCssVar('color-black');
  74. color: getCssVar('color-white');
  75. border-color: transparent;
  76. @include e(arrow) {
  77. background-color: getCssVar('color-black');
  78. border-color: transparent;
  79. }
  80. }
  81. }
  82. }