index.tsx 696 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from 'react';
  2. import { TextWrapper, Img } from './styled';
  3. type Props = WatermarkType & {
  4. viewScale: number;
  5. };
  6. const index: React.FC<Props> = ({
  7. type,
  8. text,
  9. imagepath,
  10. viewScale,
  11. scale = 1,
  12. opacity,
  13. textcolor,
  14. rotation,
  15. }: Props) =>
  16. type === 'text' ? (
  17. <TextWrapper
  18. style={{
  19. fontSize: `${viewScale * scale * 22}px`,
  20. opacity,
  21. color: textcolor,
  22. transform: `rotate(-${rotation}deg)`,
  23. }}
  24. >
  25. {text}
  26. </TextWrapper>
  27. ) : (
  28. <Img
  29. style={{
  30. opacity,
  31. transform: `scale(${viewScale * scale}) rotate(-${rotation}deg)`,
  32. }}
  33. src={imagepath}
  34. />
  35. );
  36. export default index;