bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/shape-group/component.jsx

43 lines
907 B
React
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
2017-02-23 08:10:30 +08:00
import WhiteboardShapeModel from '../shape-factory/component';
const propTypes = {
// initial width and height of the slide are required to calculate the coordinates for each shape
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
2017-06-03 03:25:02 +08:00
// array of shapes, optional
shapes: PropTypes.array,
2017-02-23 08:10:30 +08:00
};
export default class ShapeGroup extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
shapes,
width,
height,
} = this.props;
return (
<g>
2017-06-03 03:25:02 +08:00
{shapes ? shapes.map(shape =>
(<WhiteboardShapeModel
shape={shape}
key={shape.id}
2017-06-03 03:25:02 +08:00
slideWidth={width}
slideHeight={height}
/>),
2017-02-23 08:10:30 +08:00
)
: null }
</g>
);
}
}
ShapeGroup.propTypes = propTypes;