button.scss 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. // https://github.com/ckeditor/ckeditor5-theme-lark/issues/70
  60. &.ck-disabled {
  61. @include ck-button-icon {
  62. @include ck-disabled;
  63. }
  64. }
  65. &.ck-button_with-text {
  66. padding: ck-spacing( 'small' ) ck-spacing();
  67. @include ck-button-icon {
  68. margin-left: -#{ck-spacing( 'small' )};
  69. margin-right: ck-spacing( 'small' );
  70. }
  71. .ck-button__label {
  72. display: block;
  73. }
  74. }
  75. &.ck-on {
  76. @include ck-button-colors( 'foreground' );
  77. }
  78. &-action {
  79. @include ck-button-colors( 'action' );
  80. text-shadow: 0 -1px ck-color( 'action', -20 );
  81. color: ck-color();
  82. &:hover,
  83. &:focus,
  84. &:active {
  85. text-shadow: 0 -1px ck-color( 'action', -40 );
  86. }
  87. }
  88. &-bold {
  89. font-weight: bold;
  90. }
  91. .ck-icon {
  92. use,
  93. use * {
  94. color: inherit;
  95. }
  96. }
  97. .ck-button__label {
  98. float: left;
  99. line-height: inherit;
  100. font-size: inherit;
  101. font-weight: inherit;
  102. color: inherit;
  103. cursor: inherit;
  104. }
  105. }