8
0

button.scss 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // Copyright (c) 2003-2017, 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. * @param {String} $color - Background color of the button.
  7. */
  8. @mixin ck-button-colors( $color, $offset: 0 ) {
  9. background: ck-color( $color, $offset );
  10. border-color: ck-border-color( $color, $offset );
  11. @include ck-button-state-colors( $color, $offset );
  12. }
  13. /**
  14. * Implements button states.
  15. *
  16. * @param {String} $color - Background color of the button.
  17. */
  18. @mixin ck-button-state-colors( $color, $offset: 0 ) {
  19. &:not(.ck-disabled) {
  20. &:hover,
  21. &:focus {
  22. background: ck-color( $color, $offset - 10 );
  23. border-color: ck-border-color( $color, $offset - 10 );
  24. }
  25. &:active {
  26. background: ck-color( $color, $offset - 15 );
  27. border-color: ck-border-color( $color, $offset - 15 );
  28. box-shadow: inset 0 2px 2px ck-color( $color, $offset - 25 );
  29. }
  30. }
  31. }
  32. /**
  33. * A helper to define button–specific icon styles.
  34. *
  35. */
  36. @mixin ck-button-icon {
  37. .ck-icon {
  38. @content;
  39. }
  40. }
  41. .ck-button,
  42. a.ck-button {
  43. @include ck-button-colors( 'background' );
  44. @include ck-rounded-corners();
  45. border-width: 1px;
  46. border-style: solid;
  47. white-space: nowrap;
  48. cursor: default;
  49. vertical-align: middle;
  50. padding: ck-spacing( 'small' );
  51. line-height: $ck-icon-size / $ck-font-size-base;
  52. &:focus {
  53. @include ck-focus-ring();
  54. @include ck-box-shadow( $ck-focus-outer-shadow );
  55. }
  56. @include ck-button-icon {
  57. float: left;
  58. }
  59. &.ck-button_with-text {
  60. padding: ck-spacing( 'small' ) ck-spacing();
  61. @include ck-button-icon {
  62. margin-left: -#{ck-spacing( 'small' )};
  63. margin-right: ck-spacing( 'small' );
  64. }
  65. .ck-button__label {
  66. display: block;
  67. }
  68. }
  69. &.ck-on {
  70. @include ck-button-colors( 'foreground' );
  71. }
  72. &-action {
  73. @include ck-button-colors( 'action' );
  74. text-shadow: 0 -1px ck-color( 'action', -20 );
  75. color: ck-color();
  76. &:hover,
  77. &:focus,
  78. &:active {
  79. text-shadow: 0 -1px ck-color( 'action', -40 );
  80. }
  81. }
  82. &-bold {
  83. font-weight: bold;
  84. }
  85. .ck-icon {
  86. use,
  87. use * {
  88. color: inherit;
  89. }
  90. }
  91. .ck-button__label {
  92. float: left;
  93. line-height: inherit;
  94. font-size: inherit;
  95. font-weight: inherit;
  96. color: inherit;
  97. cursor: inherit;
  98. }
  99. }