button.scss 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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-focus-shadow();
  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. &:hover,
  38. &:focus {
  39. background: ck-color( $color, $offset - 10 );
  40. border-color: ck-border-color( $color, $offset - 10 );
  41. }
  42. &:active {
  43. background: ck-color( $color, $offset - 15 );
  44. border-color: ck-border-color( $color, $offset - 15 );
  45. box-shadow: inset 0 2px 2px ck-color( $color, $offset - 25 );
  46. }
  47. }
  48. /**
  49. * A helper to define button–specific icon styles.
  50. *
  51. * @access public
  52. */
  53. @mixin ck-button-icon {
  54. [class*="ck-icon"] {
  55. @content;
  56. }
  57. }
  58. .ck-button,
  59. a.ck-button {
  60. display: inline-block;
  61. overflow: hidden;
  62. padding: ck-spacing( 'small' ) ck-spacing();
  63. @include ck-button( 'background' );
  64. @include ck-unselectable();
  65. @include ck-rounded-corners();
  66. &.ck-button-notext {
  67. padding: ck-spacing( 'small' );
  68. @include ck-button-icon {
  69. margin-left: 0;
  70. margin-right: 0;
  71. }
  72. .ck-button__label {
  73. display: none;
  74. }
  75. }
  76. &.ck-on {
  77. @include ck-button( 'foreground' );
  78. }
  79. &-action {
  80. text-shadow: 0 -1px ck-color( 'action', -20 );
  81. color: ck-color();
  82. @include ck-button( 'action' );
  83. &:hover,
  84. &:focus,
  85. &:active {
  86. text-shadow: 0 -1px ck-color( 'action', -40 );
  87. }
  88. }
  89. &-bold {
  90. font-weight: bold;
  91. }
  92. .ck-icon {
  93. use,
  94. use * {
  95. color: inherit;
  96. }
  97. &-left {
  98. margin-left: -#{ck-spacing( 'small' )};
  99. }
  100. &-right {
  101. margin-right: -#{ck-spacing( 'small' )};
  102. }
  103. }
  104. .ck-button__label {
  105. float: left;
  106. line-height: inherit;
  107. font-size: inherit;
  108. font-weight: inherit;
  109. color: inherit;
  110. cursor: inherit;
  111. }
  112. }