styled.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import styled, { css } from 'styled-components';
  2. export const IconWrapper = styled('div')<{
  3. isHover: boolean;
  4. isDisabled: boolean;
  5. }>`
  6. position: relative;
  7. display: inline-flex;
  8. outline: none;
  9. width: auto;
  10. height: auto;
  11. align-items: center;
  12. justify-content: center;
  13. opacity: ${props => (props.isDisabled ? 0.7 : 1)};
  14. ${props =>
  15. props.isDisabled
  16. ? css`
  17. [data-status='normal'] {
  18. opacity: 0.6;
  19. cursor: default;
  20. }
  21. [data-status='hover'] {
  22. opacity: 0;
  23. position: absolute;
  24. top: 0;
  25. left: 0;
  26. right: 0;
  27. bottom: 0;
  28. margin: auto;
  29. }
  30. [data-status='active'] {
  31. opacity: 0;
  32. position: absolute;
  33. top: 0;
  34. left: 0;
  35. right: 0;
  36. bottom: 0;
  37. margin: auto;
  38. }
  39. `
  40. : css`
  41. cursor: pointer;
  42. [data-status='normal'] {
  43. opacity: 1;
  44. transition-delay: 100ms;
  45. }
  46. [data-status='hover'] {
  47. transition-delay: 100ms;
  48. opacity: 0;
  49. position: absolute;
  50. top: 0;
  51. left: 0;
  52. right: 0;
  53. bottom: 0;
  54. margin: auto;
  55. }
  56. [data-status='active'] {
  57. transition-delay: 100ms;
  58. opacity: 1;
  59. position: absolute;
  60. top: 0;
  61. left: 0;
  62. right: 0;
  63. bottom: 0;
  64. margin: auto;
  65. }
  66. ${props.isHover
  67. ? css`
  68. :hover {
  69. [data-status='hover'] {
  70. opacity: 1;
  71. }
  72. [data-status='normal'] {
  73. opacity: 0;
  74. }
  75. }
  76. `
  77. : null}
  78. `}
  79. `;
  80. export const ClickZone = styled.div`
  81. position: absolute;
  82. top: 0;
  83. left: 0;
  84. right: 0;
  85. bottom: 0;
  86. width: 100%;
  87. height: 100%;
  88. outline: none;
  89. z-index: 10;
  90. `;