import columnsIcon from "raw-loader!../../icons/columns-solid.svg";
export const MediaBlock = (bm, category, label, type) => {
  bm.add(type, {
    label,
    category: category,
    content: `<div class="media">
               <img class="mr-3" src="">
               <div class="media-body">
               <h5>Media heading</h5>
               <div>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</div>
               </div>
               </div>`,
    render: ({ model, className }) => `
    <div class="drapcode-compo-seventeen ${className}-label ${className}__drapcode-wrap">
    <div class="drap-on-six">${columnsIcon}</div>
    <div class="drapcode-compo-qustion ${className}__info">
      <a
        target="_blank"
        href="#"
        draggable="false"
      >
        <i class="bem-Svg ${className}__info-fa fa fa-info-circle" title="Check how to use ${label}?"></i>
      </a>
    </div>
    <div class="drapcode-com-one">${model.get("label")}</div>
  </div>
             `,
  });
};
export default (dc, label, type) => {
  const defaultType = dc.getType("default");
  const defaultModel = defaultType.model;
  const defaultView = defaultType.view;
  dc.addType(type, {
    model: defaultModel.extend(
      {
        defaults: Object.assign({}, defaultModel.prototype.defaults, {
          "custom-name": label,
          resizable: true,
          tagName: "div",
          classes: ["media"],
        }),
      },
      {
        isComponent(el) {
          if (el && el.classList && el.classList.contains("media")) {
            return { type: "media" };
          }
        },
      }
    ),
    view: defaultView,
  });
  dc.addType("media_body", {
    model: defaultModel.extend(
      {
        defaults: Object.assign({}, defaultModel.prototype.defaults, {
          "custom-name": "Media Body",
          tagName: "div",
          classes: ["media-body"],
        }),
      },
      {
        isComponent(el) {
          if (el && el.classList && el.classList.contains("media-body")) {
            return { type: "media_body" };
          }
        },
      }
    ),
    view: defaultView,
  });
};
