import Konva from "konva";

const title=function (width,height,title) {
  const group=new Konva.Group({
    x: 0,
    y: 0,
    width: width,
    height: 20,
  })

  const imageObj = new Image();
  imageObj.src = require('@/assets/kban/logo.png');
  imageObj.onload = function () {
    const shape = new Konva.Image({
      x: 0,
      y: 0,
      width: width*0.86,
      height:41,
      image: imageObj,
    });
    group.add(shape)
  }

  const text=new Konva.Text({
    x: 0,
    y: 8,
    width: width,
    height: 20,
    text: title,
    align: 'center',
    fill:'#fff',
    fontSize: 32,
    fontStyle:'bold'
  })
  group.add(text)

  return group
}

export default title
