8
0

button.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  2. // For licensing, see LICENSE.md or http://ckeditor.com/license
  3. /**
  4. * Implements a button of given background color.
  5. *
  6. * @access public
  7. * @param {String} $color - Background color of the button.
  8. */
  9. @mixin ck-button( $color ) {
  10. border: 1px solid;
  11. white-space: nowrap;
  12. cursor: pointer;
  13. vertical-align: middle;
  14. line-height: $ck-icon-size / $ck-font-size-base;
  15. position: relative;
  16. @include ck-button-colors( $color );
  17. &:focus {
  18. @include ck-focus-ring();
  19. @include ck-box-shadow( $ck-focus-outer-shadow );
  20. }
  21. }
  22. /**
  23. * Implements a button of given background color.
  24. *
  25. * @access public
  26. * @param {String} $color - Background color of the button.
  27. */
  28. @mixin ck-button-colors( $color, $offset: 0 ) {
  29. background: ck-color( $color, $offset );
  30. border-color: ck-border-color( $color, $offset );
  31. @include ck-button-state-colors( $color, $offset );
  32. }
  33. /**
  34. * Implements button states.
  35. *
  36. * @access public
  37. * @param {String} $color - Background color of the button.
  38. */
  39. @mixin ck-button-state-colors( $color, $offset: 0 ) {
  40. &:not(.ck-disabled) {
  41. &:hover,
  42. &:focus {
  43. background: ck-color( $color, $offset - 10 );
  44. border-color: ck-border-color( $color, $offset - 10 );
  45. }
  46. &:active {
  47. background: ck-color( $color, $offset - 15 );
  48. border-color: ck-border-color( $color, $offset - 15 );
  49. box-shadow: inset 0 2px 2px ck-color( $color, $offset - 25 );
  50. }
  51. }
  52. }
  53. /**
  54. * A helper to define button–specific icon styles.
  55. *
  56. * @access public
  57. */
  58. @mixin ck-button-icon {
  59. .ck-icon {
  60. @content;
  61. }
  62. }
  63. .ck-button,
  64. a.ck-button {
  65. display: inline-block;
  66. padding: ck-spacing( 'small' );
  67. @include ck-button( 'background' );
  68. @include ck-unselectable();
  69. @include ck-rounded-corners();
  70. @include ck-tooltip_enabled();
  71. @include ck-button-icon {
  72. float: left;
  73. }
  74. &.ck-button_with-text {
  75. padding: ck-spacing( 'small' ) ck-spacing();
  76. @include ck-button-icon {
  77. margin-left: -#{ck-spacing( 'small' )};
  78. margin-right: ck-spacing( 'small' );
  79. }
  80. .ck-button__label {
  81. display: block;
  82. }
  83. }
  84. &.ck-on {
  85. @include ck-button( 'foreground' );
  86. }
  87. &-action {
  88. text-shadow: 0 -1px ck-color( 'action', -20 );
  89. color: ck-color();
  90. @include ck-button( 'action' );
  91. &:hover,
  92. &:focus,
  93. &:active {
  94. text-shadow: 0 -1px ck-color( 'action', -40 );
  95. }
  96. }
  97. &-bold {
  98. font-weight: bold;
  99. }
  100. .ck-icon {
  101. use,
  102. use * {
  103. color: inherit;
  104. }
  105. }
  106. &:hover {
  107. @include ck-tooltip_visible();
  108. }
  109. // Get rid of the focus outline around the tooltip when focused (but not :hover).
  110. &:focus:not(:hover) {
  111. @include ck-tooltip_disabled();
  112. }
  113. .ck-button__label {
  114. display: none;
  115. float: left;
  116. line-height: inherit;
  117. font-size: inherit;
  118. font-weight: inherit;
  119. color: inherit;
  120. cursor: inherit;
  121. }
  122. }