styles.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import styled from 'styled-components/macro';
  2. import {keyframes} from 'styled-components';
  3. import theme from 'styled-theming';
  4. import Select from 'react-select';
  5. const fadeIn = keyframes`
  6. from {
  7. opacity: 0;
  8. transform: translateY(-10px);
  9. }
  10. to {
  11. opacity: 1;
  12. transform: translateY(0);
  13. }
  14. `;
  15. const NormalizedSelect = styled(Select)`
  16. .select {
  17. &__control {
  18. cursor: pointer;
  19. transition: var(--transition);
  20. border: none;
  21. min-height: unset;
  22. border-radius: 4px;
  23. box-shadow: none;
  24. &--is-focused, &:hover {
  25. outline: none;
  26. }
  27. &--is-focused .icon {
  28. transform: rotate(180deg);
  29. }
  30. .icon {
  31. transition: .3s ease-in-out;
  32. }
  33. }
  34. &__single-value {
  35. overflow: visible;
  36. }
  37. &__menu {
  38. min-width: max-content;
  39. width: 100%;
  40. border-radius: 12px;
  41. z-index: 100;
  42. animation: ${fadeIn} var(--transition);
  43. &.close {
  44. animation: ${fadeIn} var(--transition) reverse;
  45. }
  46. &-list {
  47. max-height: 160px;
  48. overflow-y: auto;
  49. scroll-behavior: smooth;
  50. z-index: 100;
  51. }
  52. }
  53. &__option {
  54. cursor: pointer;
  55. transition: var(--transition);
  56. &:hover,
  57. &--is-focused,
  58. &--is-selected {
  59. background: transparent;
  60. color: var(--header);
  61. }
  62. }
  63. &__indicator, &__indicator-separator {
  64. display: none;
  65. }
  66. &__value-container {
  67. padding: 0;
  68. }
  69. }
  70. `;
  71. const BasicSelect = styled(NormalizedSelect)`
  72. .select {
  73. &__control {
  74. background-color: transparent;
  75. border: 1px solid var(--border);
  76. padding: 0 12px;
  77. height: 40px;
  78. &--is-focused, &:hover {
  79. border-color: var(--highlight);
  80. }
  81. }
  82. &__placeholder {
  83. color: var(--placeholder);
  84. }
  85. &__single-value {
  86. color: var(--text);
  87. line-height: 1;
  88. }
  89. &__menu {
  90. box-shadow: var(--widget-shadow);
  91. background: var(--widget);
  92. border: ${theme('theme', {
  93. light: '1px solid var(--widget)',
  94. dark: '1px solid var(--border)',
  95. })};
  96. width: 100%;
  97. }
  98. }
  99. `;
  100. export default BasicSelect