_buttons.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. @use '../abstracts/variables' as v;
  2. @use '../abstracts/mixins' as mix;
  3. @use 'sass:color';
  4. @use 'sass:map';
  5. .btn {
  6. border: 1px solid transparent;
  7. border-radius: 50px;
  8. outline: none;
  9. -webkit-appearance: none;
  10. -moz-appearance: none;
  11. appearance: none;
  12. font-size: map.get(v.$font-sizes, 'sm');
  13. font-weight: map.get(v.$font-weights, 'semibold');
  14. display: inline-flex;
  15. align-items: center;
  16. justify-content: center;
  17. cursor: pointer;
  18. text-decoration: none;
  19. @include mix.button-base;
  20. &:focus {
  21. @include mix.box-shadow(0 0 0 3px rgba(v.$primary, 0.2));
  22. outline: none;
  23. }
  24. &:disabled,
  25. &.disabled {
  26. opacity: 0.5;
  27. pointer-events: none;
  28. cursor: not-allowed;
  29. @include mix.transform(none !important);
  30. }
  31. &:hover:not(:disabled):not(.disabled) {
  32. @include mix.transform(translateY(-1px));
  33. @include mix.box-shadow(v.$box-shadow);
  34. @include mix.respond-to-min('md') {
  35. @include mix.transform(translateY(-2px));
  36. @include mix.box-shadow(v.$box-shadow-lg);
  37. }
  38. @include mix.respond-to-min('lg') {
  39. @include mix.transform(translateY(-3px));
  40. }
  41. svg, i {
  42. @include mix.transform(scale(1.1));
  43. }
  44. }
  45. &:active:not(:disabled):not(.disabled) {
  46. @include mix.transform(translateY(0));
  47. }
  48. &.btn-xs {
  49. padding: 0.375rem 1rem;
  50. font-size: map.get(v.$font-sizes, 'xs');
  51. border-radius: 20px;
  52. @include mix.respond-to-min('md') {
  53. padding: 0.5rem 1.25rem;
  54. font-size: map.get(v.$font-sizes, 'xs');
  55. border-radius: 25px;
  56. }
  57. @include mix.respond-to-min('lg') {
  58. padding: 0.5rem 1.5rem;
  59. font-size: map.get(v.$font-sizes, 'sm');
  60. border-radius: 25px;
  61. }
  62. }
  63. &.btn-sm {
  64. padding: 0.5rem 1.5rem;
  65. font-size: map.get(v.$font-sizes, 'xs');
  66. border-radius: 25px;
  67. @include mix.respond-to-min('md') {
  68. padding: 0.625rem 1.875rem;
  69. font-size: map.get(v.$font-sizes, 'sm');
  70. border-radius: 30px;
  71. }
  72. @include mix.respond-to-min('lg') {
  73. padding: 0.75rem 2.25rem;
  74. font-size: map.get(v.$font-sizes, 'sm');
  75. border-radius: 30px;
  76. }
  77. }
  78. &.btn-lg {
  79. padding: 1rem 2.5rem;
  80. font-size: map.get(v.$font-sizes, 'base');
  81. border-radius: 50px;
  82. @include mix.respond-to-min('md') {
  83. padding: 1.125rem 3.125rem;
  84. font-size: map.get(v.$font-sizes, 'lg');
  85. border-radius: 60px;
  86. }
  87. @include mix.respond-to-min('lg') {
  88. padding: 1.25rem 3.75rem;
  89. font-size: map.get(v.$font-sizes, 'lg');
  90. border-radius: 60px;
  91. }
  92. @include mix.respond-to-min('xl') {
  93. padding: 1.375rem 4rem;
  94. font-size: map.get(v.$font-sizes, 'xl');
  95. border-radius: 70px;
  96. }
  97. }
  98. &.btn-xl {
  99. padding: 1.125rem 3rem;
  100. font-size: map.get(v.$font-sizes, 'lg');
  101. border-radius: 60px;
  102. @include mix.respond-to-min('md') {
  103. padding: 1.25rem 3.5rem;
  104. font-size: map.get(v.$font-sizes, 'xl');
  105. border-radius: 70px;
  106. }
  107. @include mix.respond-to-min('lg') {
  108. padding: 1.375rem 4rem;
  109. font-size: map.get(v.$font-sizes, 'xl');
  110. border-radius: 70px;
  111. }
  112. @include mix.respond-to-min('xl') {
  113. padding: 1.5rem 4.5rem;
  114. font-size: map.get(v.$font-sizes, '2xl');
  115. border-radius: 80px;
  116. }
  117. }
  118. &.btn-square {
  119. border-radius: 0;
  120. @include mix.respond-to-min('md') {
  121. border-radius: 2px;
  122. }
  123. }
  124. &.btn-rounded {
  125. border-radius: v.$border-radius-sm;
  126. @include mix.respond-to-min('md') {
  127. border-radius: v.$border-radius;
  128. }
  129. @include mix.respond-to-min('lg') {
  130. border-radius: v.$border-radius-lg;
  131. }
  132. }
  133. &.btn-pill {
  134. border-radius: 30px;
  135. @include mix.respond-to-min('md') {
  136. border-radius: 40px;
  137. }
  138. @include mix.respond-to-min('lg') {
  139. border-radius: 50px;
  140. }
  141. }
  142. &.btn-circle {
  143. border-radius: 50%;
  144. }
  145. &.btn-block {
  146. width: 100%;
  147. display: flex;
  148. }
  149. svg, i {
  150. width: 14px;
  151. height: 14px;
  152. margin-right: 0.375rem;
  153. @include mix.transition(transform 0.3s ease);
  154. @include mix.respond-to-min('md') {
  155. width: 16px;
  156. height: 16px;
  157. margin-right: 0.5rem;
  158. }
  159. @include mix.respond-to-min('lg') {
  160. width: 18px;
  161. height: 18px;
  162. margin-right: 0.625rem;
  163. }
  164. &:last-child {
  165. margin-right: 0;
  166. margin-left: 0.375rem;
  167. @include mix.respond-to-min('md') {
  168. margin-left: 0.5rem;
  169. }
  170. @include mix.respond-to-min('lg') {
  171. margin-left: 0.625rem;
  172. }
  173. }
  174. &:only-child {
  175. margin: 0;
  176. }
  177. }
  178. }
  179. .btn-primary {
  180. background-color: v.$primary;
  181. color: v.$white;
  182. border-color: v.$primary;
  183. &:hover:not(:disabled):not(.disabled) {
  184. background-color: v.$primary-dark;
  185. border-color: v.$primary-dark;
  186. color: v.$white;
  187. }
  188. &:active:not(:disabled):not(.disabled) {
  189. background-color: color.scale(v.$primary-dark, $lightness: -10%);
  190. border-color: color.scale(v.$primary-dark, $lightness: -10%);
  191. }
  192. }
  193. .btn-secondary {
  194. background-color: transparent;
  195. color: v.$primary;
  196. border-color: v.$primary;
  197. &:hover:not(:disabled):not(.disabled) {
  198. background-color: v.$primary;
  199. color: v.$white;
  200. border-color: v.$primary;
  201. }
  202. &:active:not(:disabled):not(.disabled) {
  203. background-color: v.$primary-dark;
  204. border-color: v.$primary-dark;
  205. color: v.$white;
  206. }
  207. }
  208. .btn-outline {
  209. background-color: v.$primary-dark;
  210. color: v.$white;
  211. border-color: v.$white;
  212. @include mix.transition(all 0.3s ease);
  213. &:hover:not(:disabled):not(.disabled) {
  214. background-color: v.$primary;
  215. color: v.$white;
  216. border-color: v.$primary;
  217. }
  218. &:active:not(:disabled):not(.disabled) {
  219. background-color: v.$primary;
  220. color: v.$white;
  221. border-color: v.$primary;
  222. }
  223. }
  224. .btn-ghost {
  225. background-color: transparent;
  226. color: var(--color-text-primary);
  227. border-color: transparent;
  228. &:hover:not(:disabled):not(.disabled) {
  229. background-color: transparent;
  230. color: v.$black;
  231. border-color: v.$white;
  232. }
  233. &:active:not(:disabled):not(.disabled) {
  234. background-color: rgba(v.$white, 0.1);
  235. border-color: rgba(v.$white, 0.5);
  236. }
  237. }
  238. .btn-text {
  239. background-color: transparent;
  240. color: v.$primary;
  241. border-color: transparent;
  242. &:hover:not(:disabled):not(.disabled) {
  243. background-color: rgba(v.$primary, 0.1);
  244. color: v.$primary;
  245. border-color: transparent;
  246. @include mix.transform(translateY(-1px));
  247. }
  248. &:active:not(:disabled):not(.disabled) {
  249. background-color: rgba(v.$primary, 0.2);
  250. @include mix.transform(translateY(0));
  251. }
  252. }
  253. .btn-get-quotes {
  254. @include mix.box-shadow(v.$box-shadow);
  255. background-color: v.$primary;
  256. color: v.$white;
  257. border-color: v.$primary;
  258. position: relative;
  259. overflow: hidden;
  260. @include mix.respond-to-max('sm') {
  261. padding: 0.625rem 1.75rem;
  262. font-size: map.get(v.$font-sizes, 'sm');
  263. }
  264. &:hover:not(:disabled):not(.disabled) {
  265. background-color: v.$primary-dark;
  266. color: v.$white;
  267. border-color: v.$white;
  268. }
  269. &:active:not(:disabled):not(.disabled) {
  270. background-color: color.scale(v.$primary-dark, $lightness: -10%);
  271. border-color: v.$white;
  272. }
  273. &::before {
  274. content: '';
  275. position: absolute;
  276. top: 0;
  277. left: -100%;
  278. width: 100%;
  279. height: 100%;
  280. background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  281. @include mix.transition(left 0.5s);
  282. }
  283. &:hover::before {
  284. left: 100%;
  285. }
  286. }
  287. .btn-icon {
  288. width: 2.25rem;
  289. height: 2.25rem;
  290. min-width: 2.25rem;
  291. padding: 0 !important;
  292. @include mix.respond-to-min('md') {
  293. width: 2.5rem;
  294. height: 2.5rem;
  295. min-width: 2.5rem;
  296. }
  297. @include mix.respond-to-min('lg') {
  298. width: 2.75rem;
  299. height: 2.75rem;
  300. min-width: 2.75rem;
  301. }
  302. @include mix.respond-to-min('xl') {
  303. width: 3rem;
  304. height: 3rem;
  305. min-width: 3rem;
  306. }
  307. &.btn-xs {
  308. width: 1.75rem;
  309. height: 1.75rem;
  310. min-width: 1.75rem;
  311. @include mix.respond-to-min('md') {
  312. width: 2rem;
  313. height: 2rem;
  314. min-width: 2rem;
  315. }
  316. }
  317. &.btn-sm {
  318. width: 2rem;
  319. height: 2rem;
  320. min-width: 2rem;
  321. @include mix.respond-to-min('md') {
  322. width: 2.25rem;
  323. height: 2.25rem;
  324. min-width: 2.25rem;
  325. }
  326. }
  327. &.btn-lg {
  328. width: 2.75rem;
  329. height: 2.75rem;
  330. min-width: 2.75rem;
  331. @include mix.respond-to-min('md') {
  332. width: 3.25rem;
  333. height: 3.25rem;
  334. min-width: 3.25rem;
  335. }
  336. @include mix.respond-to-min('lg') {
  337. width: 3.5rem;
  338. height: 3.5rem;
  339. min-width: 3.5rem;
  340. }
  341. }
  342. &.btn-xl {
  343. width: 3.25rem;
  344. height: 3.25rem;
  345. min-width: 3.25rem;
  346. @include mix.respond-to-min('md') {
  347. width: 3.75rem;
  348. height: 3.75rem;
  349. min-width: 3.75rem;
  350. }
  351. @include mix.respond-to-min('lg') {
  352. width: 4rem;
  353. height: 4rem;
  354. min-width: 4rem;
  355. }
  356. }
  357. svg, i {
  358. margin: 0 !important;
  359. width: 16px !important;
  360. height: 16px !important;
  361. @include mix.respond-to-min('md') {
  362. width: 18px !important;
  363. height: 18px !important;
  364. }
  365. @include mix.respond-to-min('lg') {
  366. width: 20px !important;
  367. height: 20px !important;
  368. }
  369. }
  370. }
  371. .btn-social {
  372. @extend .btn-icon;
  373. background-color: rgba(v.$white, 0.1);
  374. color: v.$black;
  375. border-color: transparent;
  376. &:hover:not(:disabled):not(.disabled) {
  377. color: v.$white;
  378. }
  379. &.btn-twitter:hover {
  380. background-color: #1da1f2;
  381. border-color: #1da1f2;
  382. }
  383. &.btn-facebook:hover {
  384. background-color: #4267b2;
  385. border-color: #4267b2;
  386. }
  387. &.btn-linkedin:hover {
  388. background-color: #0077b5;
  389. border-color: #0077b5;
  390. }
  391. &.btn-instagram:hover {
  392. background-color: #e4405f;
  393. border-color: #e4405f;
  394. }
  395. &.btn-youtube:hover {
  396. background-color: #ff0000;
  397. border-color: #ff0000;
  398. }
  399. &.btn-github:hover {
  400. background-color: #333;
  401. border-color: #333;
  402. }
  403. }
  404. .btn-group {
  405. display: inline-flex;
  406. vertical-align: middle;
  407. @include mix.respond-to-max('sm') {
  408. flex-direction: column;
  409. width: 100%;
  410. .btn {
  411. margin-left: 0 !important;
  412. margin-bottom: -1px;
  413. border-radius: v.$border-radius !important;
  414. &:not(:last-child) {
  415. margin-bottom: 0.5rem;
  416. }
  417. }
  418. }
  419. @include mix.respond-to-min('sm') {
  420. .btn {
  421. position: relative;
  422. flex: 1 1 auto;
  423. &:not(:first-child) {
  424. margin-left: -1px;
  425. border-top-left-radius: 0;
  426. border-bottom-left-radius: 0;
  427. }
  428. &:not(:last-child) {
  429. border-top-right-radius: 0;
  430. border-bottom-right-radius: 0;
  431. }
  432. &:hover {
  433. z-index: 1;
  434. }
  435. }
  436. }
  437. }
  438. .cta-buttons {
  439. @include mix.respond-to-max('sm') {
  440. flex-direction: column !important;
  441. gap: map.get(v.$spacers, 2) !important;
  442. .btn {
  443. width: 100% !important;
  444. }
  445. }
  446. @include mix.respond-to-min('sm') {
  447. gap: map.get(v.$spacers, 3) !important;
  448. }
  449. @include mix.respond-to-min('lg') {
  450. gap: map.get(v.$spacers, 4) !important;
  451. }
  452. }
  453. .btn-success {
  454. background-color: #28a745;
  455. color: v.$white;
  456. border-color: #28a745;
  457. &:hover:not(:disabled):not(.disabled) {
  458. background-color: #218838;
  459. border-color: #218838;
  460. color: v.$white;
  461. }
  462. }
  463. .btn-warning {
  464. background-color: #ffc107;
  465. color: #212529;
  466. border-color: #ffc107;
  467. &:hover:not(:disabled):not(.disabled) {
  468. background-color: #e0a800;
  469. border-color: #e0a800;
  470. color: #212529;
  471. }
  472. }
  473. .btn-danger {
  474. background-color: #dc3545;
  475. color: v.$white;
  476. border-color: #dc3545;
  477. &:hover:not(:disabled):not(.disabled) {
  478. background-color: #c82333;
  479. border-color: #c82333;
  480. color: v.$white;
  481. }
  482. }
  483. .btn-light {
  484. background-color: v.$white;
  485. color: v.$primary;
  486. border-color: v.$white;
  487. &:hover:not(:disabled):not(.disabled) {
  488. background-color: color.scale(v.$white, $lightness: -10%);
  489. color: v.$primary;
  490. border-color: color.scale(v.$white, $lightness: -10%);
  491. }
  492. }
  493. .btn-dark {
  494. background-color: #212529;
  495. color: v.$white;
  496. border-color: #212529;
  497. &:hover:not(:disabled):not(.disabled) {
  498. background-color: #16181b;
  499. color: v.$white;
  500. border-color: #16181b;
  501. }
  502. }
  503. .btn-loading {
  504. position: relative;
  505. color: transparent !important;
  506. pointer-events: none;
  507. &::after {
  508. content: '';
  509. position: absolute;
  510. top: 50%;
  511. left: 50%;
  512. margin: -6px 0 0 -6px;
  513. width: 12px;
  514. height: 12px;
  515. border: 1px solid transparent;
  516. border-top-color: v.$white;
  517. border-radius: 50%;
  518. animation: btn-loading-spin 1s linear infinite;
  519. @include mix.respond-to-min('md') {
  520. margin: -8px 0 0 -8px;
  521. width: 16px;
  522. height: 16px;
  523. border-width: 2px;
  524. }
  525. @include mix.respond-to-min('lg') {
  526. margin: -10px 0 0 -10px;
  527. width: 20px;
  528. height: 20px;
  529. }
  530. }
  531. }
  532. @keyframes btn-loading-spin {
  533. 0% { @include mix.transform(rotate(0deg)); }
  534. 100% { @include mix.transform(rotate(360deg)); }
  535. }