component.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { string } from "vue-types";
  2. import { useCompData } from ".";
  3. import { Image, Text } from "../../..";
  4. import { useEditor } from "../../../../..";
  5. import { createUIComp } from "../../../defines/createUIComp";
  6. import { css } from "@linaria/core";
  7. export const Component = createUIComp({
  8. props: {
  9. compId: string().isRequired,
  10. },
  11. setup(props) {
  12. const { designToNaturalSize } = useEditor().helper;
  13. const { value, children } = useCompData(props.compId);
  14. return () => (
  15. <div class="relative">
  16. <div class={upStyle}>
  17. <div class={style}>
  18. <Image.Component
  19. style={{
  20. width: designToNaturalSize(750),
  21. height: designToNaturalSize(464),
  22. }}
  23. compId={children.bgImg.id}
  24. />
  25. </div>
  26. <Image.Component
  27. class="!absolute bottom-0 transform translate-x-1/4 translate-y-1/4 rounded-1/2 overflow-hidden"
  28. style={{
  29. width: designToNaturalSize(191),
  30. height: designToNaturalSize(191),
  31. }}
  32. compId={children.item1.id}
  33. />
  34. <Image.Component
  35. class="!absolute transform rounded-1/2 overflow-hidden -translate-x-1/2 bottom-0 left-1/2"
  36. style={{
  37. width: designToNaturalSize(191),
  38. height: designToNaturalSize(191),
  39. }}
  40. compId={children.item2.id}
  41. />
  42. <Image.Component
  43. class="!absolute bottom-0 right-0 rounded-1/2 overflow-hidden transform -translate-x-24/100 -translate-y-1/3"
  44. style={{
  45. width: designToNaturalSize(191),
  46. height: designToNaturalSize(191),
  47. }}
  48. compId={children.item3.id}
  49. />
  50. </div>
  51. <div class="absolute top-0 left-0">
  52. <Text.Component compId={children.text1.id} />
  53. </div>
  54. <Text.Component compId={children.text2.id} />
  55. </div>
  56. );
  57. },
  58. });
  59. const upStyle = css`
  60. position:relative;
  61. `
  62. const style = css`
  63. background: gray;
  64. clip-path: polygon(0 0, 100% 0, 100% 57%, 0 100%);
  65. transform-origin: center;
  66. transform: translate(0%, 0%) scale(1);
  67. `;