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/Card12/thumbnail.jpg"),
};

export const { createComp, useCompData } = createCompHooks({
  value: {
    themeColor: "#5BA9CB",
  },
  layout: {
    size: [750, 800],
  },
  children: {
    text: () =>
      createCompId("Text", {
        value: `<p><span style="font-size:20px;"><strong>P190-2#</strong></span></p>`,
        layout: {
          textAlign: "center",
          size: [240, 60],
        },
      }),
    text2: () =>
      createCompId("Text", {
        value: `<p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);">2#</span><br><span style="color:hsl(0, 0%, 0%);">克莱因蓝</span></p>`,
        layout: {
          textAlign: "center",
          size: [124, 80],
        },
      }),
    img1: () =>
      createCompId("Image", {
        value: {
          url: require("@/assets/comps/Card12/img_1.jpg"),
        },
        layout: {
          size: [622, 622],
        },
      }),
  },
});

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