button.scss 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. padding: ck-spacing( 'small' ) ck-spacing();
  16. position: relative;
  17. @include ck-button-colors( $color );
  18. @include ck-focus-shadow();
  19. }
  20. /**
  21. * Implements a button of given background color.
  22. *
  23. * @access public
  24. * @param {String} $color - Background color of the button.
  25. */
  26. @mixin ck-button-colors( $color, $offset: 0 ) {
  27. background: ck-color( $color, $offset );
  28. border-color: ck-border-color( $color, $offset );
  29. @include ck-button-state-colors( $color, $offset );
  30. }
  31. /**
  32. * Implements button states.
  33. *
  34. * @access public
  35. * @param {String} $color - Background color of the button.
  36. */
  37. @mixin ck-button-state-colors( $color, $offset: 0 ) {
  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. * A helper to define button–specific icon styles.
  51. *
  52. * @access public
  53. */
  54. @mixin ck-button-icon {
  55. [class*="ck-icon"] {
  56. @content;
  57. }
  58. }
  59. .ck-button,
  60. a.ck-button {
  61. display: inline-block;
  62. overflow: hidden;
  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. }
  73. &.ck-on {
  74. @include ck-button( 'foreground' );
  75. }
  76. &-action {
  77. text-shadow: 0 -1px ck-color( 'action', -20 );
  78. color: ck-color();
  79. @include ck-button( 'action' );
  80. &:hover,
  81. &:focus,
  82. &:active {
  83. text-shadow: 0 -1px ck-color( 'action', -40 );
  84. }
  85. }
  86. &-bold {
  87. font-weight: bold;
  88. }
  89. .ck-icon {
  90. use,
  91. use * {
  92. color: inherit;
  93. }
  94. &-left {
  95. margin-left: -#{ck-spacing( 'small' )};
  96. }
  97. &-right {
  98. margin-right: -#{ck-spacing( 'small' )};
  99. }
  100. }
  101. }