/** * Copyright (c) 2017-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const React = require('react'); const classNames = require('classnames'); const MarkdownBlock = require('./MarkdownBlock.js'); class GridBlock extends React.Component { renderBlock(block) { const blockClasses = classNames('blockElement', this.props.className, { alignCenter: this.props.align === 'center', alignRight: this.props.align === 'right', fourByGridBlock: this.props.layout === 'fourColumn', imageAlignSide: block.image && (block.imageAlign === 'left' || block.imageAlign === 'right'), imageAlignTop: block.image && block.imageAlign === 'top', imageAlignRight: block.image && block.imageAlign === 'right', imageAlignBottom: block.image && block.imageAlign === 'bottom', imageAlignLeft: block.image && block.imageAlign === 'left', threeByGridBlock: this.props.layout === 'threeColumn', twoByGridBlock: this.props.layout === 'twoColumn', }); const topLeftImage = (block.imageAlign === 'top' || block.imageAlign === 'left') && this.renderBlockImage(block.image, block.imageLink, block.imageAlt); const bottomRightImage = (block.imageAlign === 'bottom' || block.imageAlign === 'right') && this.renderBlockImage(block.image, block.imageLink, block.imageAlt); return (