You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8 KiB

  1. import { css } from '@/theme'
  2. export const useScrollStyle = () => {
  3. const scrollbar = css`
  4. &::-webkit-scrollbar {
  5. //width: 6px;
  6. //height: 6px;
  7. //background-color: rgb(252, 252, 252);
  8. width: 9px;
  9. height: 9px;
  10. }
  11. &::-webkit-scrollbar-track {
  12. //box-shadow: inset 0 0 6px rgba(173, 173, 173, 0.15);
  13. //border-radius: 10px;
  14. //background-color: #fcfcfc;
  15. border-radius: 8px;
  16. background-color: transparent;
  17. &:hover {
  18. background-color: rgba(0, 0, 0, .06);
  19. -webkit-box-shadow: -1px 0 0 #fff inset, 1px 0 0 hsla(0, 0%, 100%, .9) inset, 0 -1px 0 hsla(0, 0%, 100%, .9) inset, 0 1px 0 hsla(0, 0%, 100%, .9) inset
  20. }
  21. &:active {
  22. background-color: rgba(0, 0, 0, .1)
  23. }
  24. }
  25. &::-webkit-scrollbar-thumb {
  26. //height: 20px;
  27. //border-radius: 10px;
  28. //box-shadow: inset 0 0 6px rgba(0, 0, 0, .12);
  29. //background-color: #cbcbcb;
  30. border-radius: 8px;
  31. background-color: rgba(0, 0, 0, .1);
  32. -webkit-box-shadow: -2px 0 0 #fff inset, 1px 0 0 #fff inset, 0 -1px 0 hsl(0deg 0% 100% / 90%) inset, 0 1px 0 hsl(0deg 0% 100% / 90%) inset;
  33. &:hover {
  34. background-color: rgba(0, 0, 0, .4)
  35. }
  36. &:active {
  37. background: rgba(0, 0, 0, .6)
  38. }
  39. }
  40. `
  41. const scrollbarBackground = css`
  42. background: linear-gradient(#fff 30%, hsla(0, 0%, 100%, 0)),
  43. linear-gradient(hsla(0, 0%, 100%, 0), #fff 70%) 0 100%,
  44. radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .1), transparent),
  45. radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .1), transparent) 0 100%;
  46. background-repeat: no-repeat;
  47. background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
  48. background-attachment: local, local, scroll, scroll;
  49. ${scrollbar.toString()}
  50. `
  51. return {
  52. scrollbarBackground,
  53. scrollbar,
  54. }
  55. }