styled.ts 1.6 KB

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