lint(curly): consistent use of curly brackets in codebase (#3584)
This commit is contained in:
1 parent
9ae3d9f769
commit
5d435424e2
113 files changed
+1501
-1056
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
function LayoutSelector({ onSelection, rows, columns}) {
|
||||
function LayoutSelector({ onSelection, rows, columns }) {
|
||||
const [hoveredIndex, setHoveredIndex] = useState();
|
||||
const hoverX = hoveredIndex % columns;
|
||||
const hoverY = Math.floor(hoveredIndex / columns);
|
||||
@@ -12,7 +12,7 @@ function LayoutSelector({ onSelection, rows, columns}) {
|
||||
return x <= hoverX && y <= hoverY;
|
||||
};
|
||||
|
||||
const gridSize = '20px '
|
||||
const gridSize = '20px ';
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -23,27 +23,31 @@ function LayoutSelector({ onSelection, rows, columns}) {
|
||||
}}
|
||||
className="p-2"
|
||||
>
|
||||
{Array.apply(null, Array(rows*columns)).map(function (_, i) {return i;}).map(index => (
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
border: '1px solid white',
|
||||
backgroundColor: isHovered(index) ? '#5acce6' : '#0b1a42',
|
||||
}}
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
const x = index % columns;
|
||||
const y = Math.floor(index / columns);
|
||||
{Array.apply(null, Array(rows * columns))
|
||||
.map(function(_, i) {
|
||||
return i;
|
||||
})
|
||||
.map(index => (
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
border: '1px solid white',
|
||||
backgroundColor: isHovered(index) ? '#5acce6' : '#0b1a42',
|
||||
}}
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
const x = index % columns;
|
||||
const y = Math.floor(index / columns);
|
||||
|
||||
onSelection({
|
||||
numRows: y + 1,
|
||||
numCols: x + 1,
|
||||
});
|
||||
}}
|
||||
onMouseEnter={() => setHoveredIndex(index)}
|
||||
onMouseLeave={() => setHoveredIndex(-1)}
|
||||
></div>
|
||||
))}
|
||||
onSelection({
|
||||
numRows: y + 1,
|
||||
numCols: x + 1,
|
||||
});
|
||||
}}
|
||||
onMouseEnter={() => setHoveredIndex(index)}
|
||||
onMouseLeave={() => setHoveredIndex(-1)}
|
||||
></div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -51,7 +55,7 @@ function LayoutSelector({ onSelection, rows, columns}) {
|
||||
LayoutSelector.defaultProps = {
|
||||
onSelection: () => {},
|
||||
columns: 3,
|
||||
rows: 3
|
||||
rows: 3,
|
||||
};
|
||||
|
||||
LayoutSelector.propTypes = {
|
||||
|
||||
Reference in new issue
Block a user