buttons.css 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /* https://codepen.io/nonsalant/pen/mdKJyzJ/f70c96b7e3ec615a0b2fbe4f320855f9?editors=1100 */
  2. /* design system for action buttons (postcss👆) */
  3. .button,
  4. .ql-html-buttonCancel, .ql-html-buttonOk {
  5. appearance: none;
  6. -webkit-appearance: none;
  7. -moz-appearance: none;
  8. background: var(--clr-500);
  9. color: #fff;
  10. display: flex;
  11. align-items: center;
  12. justify-content: center;
  13. gap: 0;
  14. border: none;
  15. border-radius: 8px;
  16. overflow: hidden;
  17. text-decoration: none;
  18. font-size: 16px;
  19. line-height: 26px;
  20. cursor: pointer;
  21. margin: 0;
  22. padding: 10px 35px;
  23. padding-inline: clamp(20px, 5vw, 35px);
  24. padding-inline: clamp(20px,2vw,35px);
  25. max-width: max-content;
  26. user-select: none;
  27. transition: outline .4s cubic-bezier(0.22, 1, 0.36, 1);
  28. font-family: "Open Sans",sans-serif;
  29. /* font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; */
  30. letter-spacing: .025em;
  31. font-weight: 400;
  32. /* text-transform: uppercase; */
  33. &:hover:not([disabled]) {
  34. background: var(--clr-600);
  35. }
  36. &:active:not([disabled]) {
  37. background: var(--clr-700);
  38. transform: translate(2px 3px);
  39. transform: scale(.975);
  40. transition: transform .3s cubic-bezier(0.22, 1, 0.36, 1),
  41. outline .4s cubic-bezier(0.22, 1, 0.36, 1),
  42. background-color .2s linear;
  43. }
  44. &[disabled] {
  45. filter: grayscale(0.75) contrast(0.75) brightness(0.96);
  46. cursor: default;
  47. transition: all .4s cubic-bezier(0.22, 1, 0.36, 1);
  48. }
  49. }
  50. /* buttons with icons */
  51. .button:has(.icon) {
  52. padding: 0;
  53. gap: 0;
  54. place-self: center;
  55. & > * {
  56. display: inline-flex;
  57. display: flex;
  58. align-items: center;
  59. align-items: space-evenly;
  60. /*align-self: stretch;*/
  61. justify-content: center;
  62. gap: 0.5ex;
  63. padding: 10px 35px;
  64. padding-inline: clamp(20px, 2.5vw, 35px);
  65. /* * fix or simplify to max() */
  66. padding-inline: clamp(20px, min(2.5vw, 1.5em), 35px);
  67. height: 100%;
  68. /* background-color: rgba(0, 0, 0, 0.16); */
  69. }
  70. & .icon {
  71. font-size: 1.5em;
  72. background-color: transparent;
  73. background-color: rgba(0, 0, 0, 0.16);
  74. /* * fix or simplify to max() */
  75. padding-inline: clamp(20px, min(2.5vw, 1.5em), 24px);
  76. /* padding-inline: clamp(20px, min(2.5vw, 1.5em), 35px); */
  77. &.small-padding {
  78. padding-inline: 10px;
  79. }
  80. }
  81. }
  82. /* button colors */
  83. .button,
  84. .ql-html-buttonCancel, .ql-html-buttonOk {
  85. --clr-500: var(--clr-blue-desaturated-500);
  86. --clr-600: var(--clr-blue-desaturated-600);
  87. --clr-700: var(--clr-blue-desaturated-700);
  88. }
  89. .button.primary,
  90. .ql-html-buttonOk {
  91. --clr-500: var(--clr-blue-500);
  92. --clr-600: var(--clr-blue-600);
  93. --clr-700: var(--clr-blue-700);
  94. }
  95. .button.danger {
  96. --clr-500: var(--clr-red-500);
  97. --clr-600:var(--clr-red-600);
  98. --clr-700:var(--clr-red-700);
  99. }
  100. .button.success {
  101. /* success (green) */
  102. --clr-500: var(--clr-green-desaturated-500);
  103. --clr-600: var(--clr-green-desaturated-600);
  104. --clr-700: var(--clr-green-desaturated-700);
  105. }
  106. .button.warning,
  107. .ql-html-buttonCancel {
  108. /* warning (brown/yellow) */
  109. --clr-500: var(--clr-red-desaturated-500);
  110. --clr-600:var(--clr-red-desaturated-600);
  111. --clr-700:var(--clr-red-desaturated-700);
  112. }
  113. /* https://paletton.com/#uid=7380u0kllllaFw0g0qFqFg0w0aF */
  114. /* https://www.peko-step.com/en/tool/hslrgb_en.html */
  115. .invert-colors .button {
  116. /* filter: invert(1) hue-rotate(180deg); */
  117. /* border: solid 1px hsl(0deg 0% 100% / 10%); */
  118. & {
  119. filter: invert(1) hue-rotate(180deg);
  120. background: var(--clr-600);
  121. border: solid 1px hsl(0deg 0% 100% / 10%);
  122. outline-color: #fff;
  123. }
  124. &:hover:not([disabled]) {
  125. background: var(--clr-700);
  126. }
  127. &:active:not([disabled]) {
  128. background: var(--clr-500);
  129. }
  130. &[disabled] {
  131. filter: grayscale(.75) contrast(.75) brightness(.96) invert(1) hue-rotate(180deg);
  132. cursor: default;
  133. }
  134. & > * {
  135. background-color: rgba(0, 0, 0, 0.16);
  136. }
  137. & .icon {
  138. background-color: transparent;
  139. /* background-color: rgba(0, 0, 0, 0.16); */
  140. border-inline-start: solid 1px hsl(0deg 0% 100% / 5%);
  141. }
  142. }
  143. /* Button sizes */
  144. .size-300.button {
  145. padding: 5px 18px;
  146. border-radius: 4px;
  147. border-radius: 6px;
  148. }
  149. .size-300.button:has(.icon) {
  150. padding: 0;
  151. & > * {
  152. padding: 5px 175px;
  153. padding-inline: clamp(10px, min(1.25vw, 0.75em), 17.5px);
  154. }
  155. & .icon {
  156. padding-inline: clamp(10px, min(1.25vw, 0.75em), 12px);
  157. /* font-size: 1rem;
  158. padding-block: 10px; */
  159. font-size: 1.25rem;
  160. padding-block: 8px;
  161. }
  162. }
  163. @media (width<535px) {
  164. .button {
  165. padding: 5px 18px;
  166. }
  167. .button:has(.icon) {
  168. padding: 0;
  169. & > * {
  170. padding: 5px 175px;
  171. padding-inline: clamp(10px, min(1.25vw, 0.75em), 17.5px);
  172. }
  173. & .icon {
  174. padding-inline: clamp(10px, min(1.25vw, 0.75em), 12px);
  175. /* font-size: 1rem;
  176. padding-block: 10px; */
  177. font-size: 1.25rem;
  178. padding-block: 8px;
  179. }
  180. }
  181. }