button.scss 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. @include ck-user-focus-outline();
  18. }
  19. /**
  20. * Implements a button of given background color.
  21. *
  22. * @access public
  23. * @param {String} $color - Background color of the button.
  24. */
  25. @mixin ck-button-colors( $color, $offset: 0 ) {
  26. background: ck-color( $color, $offset );
  27. border-color: ck-border-color( $color, $offset );
  28. @include ck-button-state-colors( $color, $offset );
  29. }
  30. /**
  31. * Implements button states.
  32. *
  33. * @access public
  34. * @param {String} $color - Background color of the button.
  35. */
  36. @mixin ck-button-state-colors( $color, $offset: 0 ) {
  37. &:not(.ck-disabled) {
  38. &:hover,
  39. &:focus {
  40. background: ck-color( $color, $offset - 10 );
  41. border-color: ck-border-color( $color, $offset - 10 );
  42. }
  43. &:active {
  44. background: ck-color( $color, $offset - 15 );
  45. border-color: ck-border-color( $color, $offset - 15 );
  46. box-shadow: inset 0 2px 2px ck-color( $color, $offset - 25 );
  47. }
  48. }
  49. }
  50. /**
  51. * A helper to define button–specific icon styles.
  52. *
  53. * @access public
  54. */
  55. @mixin ck-button-icon {
  56. .ck-icon {
  57. @content;
  58. }
  59. }
  60. .ck-button,
  61. a.ck-button {
  62. display: inline-block;
  63. overflow: hidden;
  64. padding: ck-spacing( 'small' );
  65. @include ck-button( 'background' );
  66. @include ck-unselectable();
  67. @include ck-rounded-corners();
  68. @include ck-button-icon {
  69. float: left;
  70. }
  71. &.ck-button_with-text {
  72. padding: ck-spacing( 'small' ) ck-spacing();
  73. @include ck-button-icon {
  74. margin-left: -#{ck-spacing( 'small' )};
  75. margin-right: ck-spacing( 'small' );
  76. }
  77. .ck-button__label {
  78. display: block;
  79. }
  80. }
  81. &.ck-on {
  82. @include ck-button( 'foreground' );
  83. }
  84. &-action {
  85. text-shadow: 0 -1px ck-color( 'action', -20 );
  86. color: ck-color();
  87. @include ck-button( 'action' );
  88. &:hover,
  89. &:focus,
  90. &:active {
  91. text-shadow: 0 -1px ck-color( 'action', -40 );
  92. }
  93. }
  94. &-bold {
  95. font-weight: bold;
  96. }
  97. .ck-icon {
  98. use,
  99. use * {
  100. color: inherit;
  101. }
  102. }
  103. .ck-button__label {
  104. display: none;
  105. float: left;
  106. line-height: inherit;
  107. font-size: inherit;
  108. font-weight: inherit;
  109. color: inherit;
  110. cursor: inherit;
  111. }
  112. }