import { createAttrsForm } from "../../../defines/createAttrsForm";
import { createCompHooks } from "../../../defines/createCompHooks";
import { createCompId } from "../../../defines/createCompId";
import { createColorOpts } from "../../../defines/formOpts/createColorOpts";

export { Component } from "./component";

export const options = {
  name: "卡片",
  thumbnail: require("@/assets/comps/Card15/thumbnail.jpg"),
};

export const { createComp, useCompData } = createCompHooks({
  value: {
    themeColor: "#6D8D70",
  },
  layout: {
    size: [750, 1200],
  },
  children: {
    title: () =>
      createCompId("Text", {
        value:
          '<p><span style="font-size:24px;"><strong>P190-3#</strong></span></p>',
        layout: {
          size: [260, 60],
        },
      }),
    colorText: () =>
      createCompId("Text", {
        value: `<p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);font-size:12px;">3#&nbsp;</span></p><p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);font-size:12px;">铜绿色</span></p>`,
        layout: {
          size: [130, 80],
        },
      }),
    text: () =>
      createCompId("Text", {
        value: `<p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">绿色是个舒服的颜色，&nbsp;</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">处处充满着生机和希望，</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;其明净空旷往往让人迷失其中，</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;给人无限的对未来的憧憬，</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;不需要过多的言语，让心灵感到平和</span></p>`,
        layout: {
          size: [475, 328],
        },
      }),
    img2: () =>
      createCompId("Image", {
        value: {
          url: require("@/assets/comps/Card15/img_shoe.png"),
        },
        layout: {
          size: [400, 285],
        },
      }),
    img1: () =>
      createCompId("Image", {
        value: {
          url: require("@/assets/comps/Card15/img_1.jpg"),
        },
        layout: {
          size: [622, 622],
        },
      }),
  },
});

export const Form = createAttrsForm([
  {
    label: "主题色",
    dataIndex: "value.themeColor",
    ...createColorOpts(),
  },
]);
