Brak opisu

mixins.scss 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Responsive breakpoints mixin
  2. @mixin add_variables( $view: frontend ) {
  3. @if frontend == $view {
  4. :root {
  5. @content;
  6. }
  7. }
  8. @if editor == $view {
  9. :root,
  10. body {
  11. @content;
  12. }
  13. }
  14. }
  15. // Button style
  16. // - Applies button styles to blocks and elements that share them.
  17. @mixin button-style() {
  18. border: var(--button--border-width) solid transparent;
  19. border-radius: var(--button--border-radius);
  20. cursor: pointer;
  21. font-weight: var(--button--font-weight);
  22. font-family: var(--button--font-family);
  23. font-size: var(--button--font-size);
  24. line-height: var(--button--line-height);
  25. padding: var(--button--padding-vertical) var(--button--padding-horizontal);
  26. text-decoration: none;
  27. // Standard Button Color Relationship Logic
  28. &:not(:hover):not(:active) {
  29. // Text colors
  30. &:not(.has-text-color) {
  31. color: var(--global--color-background);
  32. // Nested
  33. .has-background & {
  34. color: var(--local--color-background, var(--global--color-primary));
  35. &.has-background {
  36. color: var(--global--color-primary);
  37. }
  38. }
  39. }
  40. // Background-colors
  41. &:not(.has-background) {
  42. background-color: var(--global--color-primary);
  43. // Nested
  44. .has-background & {
  45. background-color: var(--local--color-primary, var(--global--color-primary));
  46. }
  47. }
  48. }
  49. // Hover Button color should match parent element foreground color
  50. &:hover,
  51. &:active {
  52. background-color: transparent;
  53. border-color: currentColor;
  54. color: inherit;
  55. }
  56. // Focus Button outline color should always match the current text color
  57. &:focus {
  58. outline-offset: -6px;
  59. outline: 2px dotted currentColor;
  60. }
  61. // Disabled Button colors
  62. &:disabled {
  63. background-color: var(--global--color-white-50);
  64. border-color: var(--global--color-white-50);
  65. color: var(--button--color-text-active);
  66. }
  67. }
  68. @mixin innerblock-margin-clear($container) {
  69. // Clear the top margin for the first-child.
  70. > #{$container} > *:first-child {
  71. margin-top: 0;
  72. }
  73. // Last child that is not the appender.
  74. > #{$container} > *:last-child:not(.block-list-appender) {
  75. margin-bottom: 0;
  76. }
  77. // When selected, the last item becomes the second last because of the appender.
  78. &.has-child-selected > #{$container} > *:nth-last-child(2),
  79. &.is-selected > #{$container} > *:nth-last-child(2) {
  80. margin-bottom: 0;
  81. }
  82. }