mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
Run Prettier
This commit is contained in:
parent
a7b5148e06
commit
fbae29b0ff
29 changed files with 1311 additions and 987 deletions
|
@ -7,31 +7,32 @@
|
|||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
const React = require('react');
|
||||
const classNames = require('classnames');
|
||||
const React = require("react");
|
||||
const classNames = require("classnames");
|
||||
|
||||
const Marked = require('./Marked.js');
|
||||
const Marked = require("./Marked.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',
|
||||
'imageAlignBottom': (block.image && block.imageAlign === 'bottom'),
|
||||
'imageAlignSide': (block.image && (block.imageAlign === 'left' ||
|
||||
block.imageAlign === 'right')),
|
||||
'imageAlignTop': (block.image && block.imageAlign === 'top'),
|
||||
'threeByGridBlock': this.props.layout === 'threeColumn',
|
||||
'twoByGridBlock': this.props.layout === 'twoColumn',
|
||||
const blockClasses = classNames("blockElement", this.props.className, {
|
||||
alignCenter: this.props.align === "center",
|
||||
alignRight: this.props.align === "right",
|
||||
fourByGridBlock: this.props.layout === "fourColumn",
|
||||
imageAlignBottom: block.image && block.imageAlign === "bottom",
|
||||
imageAlignSide:
|
||||
block.image &&
|
||||
(block.imageAlign === "left" || block.imageAlign === "right"),
|
||||
imageAlignTop: block.image && block.imageAlign === "top",
|
||||
threeByGridBlock: this.props.layout === "threeColumn",
|
||||
twoByGridBlock: this.props.layout === "twoColumn"
|
||||
});
|
||||
|
||||
const topLeftImage = (block.imageAlign === 'top' ||
|
||||
block.imageAlign === 'left') &&
|
||||
const topLeftImage =
|
||||
(block.imageAlign === "top" || block.imageAlign === "left") &&
|
||||
this.renderBlockImage(block.image);
|
||||
|
||||
const bottomRightImage = (block.imageAlign === 'bottom' ||
|
||||
block.imageAlign === 'right') &&
|
||||
const bottomRightImage =
|
||||
(block.imageAlign === "bottom" || block.imageAlign === "right") &&
|
||||
this.renderBlockImage(block.image);
|
||||
|
||||
return (
|
||||
|
@ -39,7 +40,9 @@ class GridBlock extends React.Component {
|
|||
{topLeftImage}
|
||||
<div className="blockContent">
|
||||
{this.renderBlockTitle(block.title)}
|
||||
<Marked>{block.content}</Marked>
|
||||
<Marked>
|
||||
{block.content}
|
||||
</Marked>
|
||||
</div>
|
||||
{bottomRightImage}
|
||||
</div>
|
||||
|
@ -49,7 +52,9 @@ class GridBlock extends React.Component {
|
|||
renderBlockImage(image) {
|
||||
if (image) {
|
||||
return (
|
||||
<div className="blockImage"><img src={image} /></div>
|
||||
<div className="blockImage">
|
||||
<img src={image} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
|
@ -58,7 +63,11 @@ class GridBlock extends React.Component {
|
|||
|
||||
renderBlockTitle(title) {
|
||||
if (title) {
|
||||
return <h2>{title}</h2>;
|
||||
return (
|
||||
<h2>
|
||||
{title}
|
||||
</h2>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -74,10 +83,10 @@ class GridBlock extends React.Component {
|
|||
}
|
||||
|
||||
GridBlock.defaultProps = {
|
||||
align: 'left',
|
||||
align: "left",
|
||||
contents: [],
|
||||
imagealign: 'top',
|
||||
layout: 'twoColumn',
|
||||
imagealign: "top",
|
||||
layout: "twoColumn"
|
||||
};
|
||||
|
||||
module.exports = GridBlock;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue