import react, { Fragment, ReactElement, ReactSVGElement } from 'react';

interface SlippyBoardProperties {
  boardSize: number;
  shift: { x: number; y: number };
  zoom: number;
  layers?: { key: string; content: ReactElement }[];
}

const SlippyBoard: react.FC<SlippyBoardProperties> = (
  props: SlippyBoardProperties
) => {
  return (
    <svg height={props.boardSize} width={props.boardSize}>
      <g
        transform={`translate(${props.shift.x}, ${props.shift.y}) scale(${props.zoom})`}
      >
        {props.layers
          ? props.layers.map((layer) => (
              <Fragment key={layer.key}>{layer.content}</Fragment>
            ))
          : null}
      </g>
    </svg>
  );
};

export default SlippyBoard;
