1
0

styles.ts 731 B

12345678910111213141516171819202122232425262728
  1. import { css } from '@emotion/react'
  2. export const toPx = (n: number | string) => (typeof n === 'number' ? `${n}px` : n)
  3. export type MaskProps = {
  4. visibleShadows: {
  5. left: boolean
  6. right: boolean
  7. }
  8. }
  9. export const getMaskImage = ({ visibleShadows }: MaskProps) => {
  10. if (visibleShadows.left && visibleShadows.right) {
  11. return css`
  12. mask-image: linear-gradient(to left, transparent 5%, black 25%, black 75%, transparent 95%);
  13. `
  14. }
  15. if (visibleShadows.left) {
  16. return css`
  17. mask-image: linear-gradient(90deg, rgb(0 0 0 / 0) 5%, rgb(0 0 0 / 1) 25%);
  18. `
  19. }
  20. if (visibleShadows.right) {
  21. return css`
  22. mask-image: linear-gradient(270deg, rgb(0 0 0 / 0) 5%, rgb(0 0 0 / 1) 25%);
  23. `
  24. }
  25. }