link.scss 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/var' as *;
  4. @use 'mixins/utils' as *;
  5. @use 'common/var' as *;
  6. @include b(link) {
  7. @include set-component-css-var('link', $link);
  8. }
  9. @include b(link) {
  10. display: inline-flex;
  11. flex-direction: row;
  12. align-items: center;
  13. justify-content: center;
  14. vertical-align: middle;
  15. position: relative;
  16. text-decoration: none;
  17. outline: none;
  18. cursor: pointer;
  19. padding: 0;
  20. font-size: getCssVar('link', 'font-size');
  21. font-weight: getCssVar('link', 'font-weight');
  22. color: getCssVar('link', 'text-color');
  23. @include when(hover-underline) {
  24. &:hover:after {
  25. content: '';
  26. position: absolute;
  27. left: 0;
  28. right: 0;
  29. height: 0;
  30. bottom: 0;
  31. border-bottom: 1px solid getCssVar('link', 'hover-text-color');
  32. }
  33. }
  34. @include when(underline) {
  35. &:after {
  36. content: '';
  37. position: absolute;
  38. left: 0;
  39. right: 0;
  40. height: 0;
  41. bottom: 0;
  42. border-bottom: 1px solid getCssVar('link', 'text-color');
  43. }
  44. }
  45. &:hover {
  46. color: getCssVar('link', 'hover-text-color');
  47. &:after {
  48. border-color: getCssVar('link', 'hover-text-color');
  49. }
  50. }
  51. & [class*='#{$namespace}-icon-'] {
  52. & + span {
  53. margin-left: 5px;
  54. }
  55. }
  56. @include e(inner) {
  57. display: inline-flex;
  58. justify-content: center;
  59. align-items: center;
  60. }
  61. @each $type in $types {
  62. &.#{$namespace}-link--#{$type} {
  63. @include css-var-from-global(('link', 'text-color'), ('color', $type));
  64. @include css-var-from-global(
  65. ('link', 'hover-text-color'),
  66. ('color', $type, 'light-3')
  67. );
  68. @include css-var-from-global(
  69. ('link', 'disabled-text-color'),
  70. ('color', $type, 'light-5')
  71. );
  72. }
  73. }
  74. @include when(disabled) {
  75. color: getCssVar('link', 'disabled-text-color');
  76. cursor: not-allowed;
  77. &:after {
  78. border-color: getCssVar('link', 'disabled-text-color');
  79. }
  80. }
  81. }