Skip to content

Commit

Permalink
chore(dev): re-run Prettier with 2.0
Browse files Browse the repository at this point in the history
Very slight style changes
  • Loading branch information
STRML committed Jul 20, 2020
1 parent 33ccfa5 commit 105a11b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions lib/GridItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,28 +105,28 @@ export default class GridItem extends React.Component<Props, State> {
h: PropTypes.number.isRequired,

// All optional
minW: function(props: Props, propName: string) {
minW: function (props: Props, propName: string) {
const value = props[propName];
if (typeof value !== "number") return new Error("minWidth not Number");
if (value > props.w || value > props.maxW)
return new Error("minWidth larger than item width/maxWidth");
},

maxW: function(props: Props, propName: string) {
maxW: function (props: Props, propName: string) {
const value = props[propName];
if (typeof value !== "number") return new Error("maxWidth not Number");
if (value < props.w || value < props.minW)
return new Error("maxWidth smaller than item width/minWidth");
},

minH: function(props: Props, propName: string) {
minH: function (props: Props, propName: string) {
const value = props[propName];
if (typeof value !== "number") return new Error("minHeight not Number");
if (value > props.h || value > props.maxH)
return new Error("minHeight larger than item height/maxHeight");
},

maxH: function(props: Props, propName: string) {
maxH: function (props: Props, propName: string) {
const value = props[propName];
if (typeof value !== "number") return new Error("maxHeight not Number");
if (value < props.h || value < props.minH)
Expand Down
8 changes: 4 additions & 4 deletions lib/ReactGridLayoutPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default {
draggableHandle: PropTypes.string,

// Deprecated
verticalCompact: function(props: Props) {
verticalCompact: function (props: Props) {
if (
props.verticalCompact === false &&
process.env.NODE_ENV !== "production"
Expand All @@ -91,7 +91,7 @@ export default {

// layout is an array of object with the format:
// {x: Number, y: Number, w: Number, h: Number, i: String}
layout: function(props: Props) {
layout: function (props: Props) {
var layout = props.layout;
// I hope you're setting the data-grid property on the grid items
if (layout === undefined) return;
Expand Down Expand Up @@ -164,12 +164,12 @@ export default {
}),

// Children must not have duplicate keys.
children: function(props: Props, propName: string) {
children: function (props: Props, propName: string) {
var children = props[propName];

// Check children keys for duplicates. Throw if found.
var keys = {};
React.Children.forEach(children, function(child) {
React.Children.forEach(children, function (child) {
if (keys[child.key]) {
throw new Error(
'Duplicate child key "' +
Expand Down
2 changes: 1 addition & 1 deletion lib/ResponsiveReactGridLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
getColsFromBreakpoint,
findOrGenerateResponsiveLayout,
type ResponsiveLayout,
type Breakpoints,
type Breakpoints
} from "./responsiveUtils";
import ReactGridLayout from "./ReactGridLayout";

Expand Down
8 changes: 5 additions & 3 deletions lib/responsiveUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cloneLayout, compact, correctBounds } from "./utils";
import type { CompactType, Layout } from "./utils";

export type Breakpoint = string;
export type DefaultBreakpoints = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';
export type DefaultBreakpoints = "lg" | "md" | "sm" | "xs" | "xxs";

// + indicates read-only
export type ResponsiveLayout<T: Breakpoint> = {
Expand Down Expand Up @@ -103,9 +103,11 @@ export function findOrGenerateResponsiveLayout(
* @param {Object} breakpoints Key/value pair of breakpoint names to widths.
* @return {Array} Sorted breakpoints.
*/
export function sortBreakpoints(breakpoints: Breakpoints<Breakpoint>): Array<Breakpoint> {
export function sortBreakpoints(
breakpoints: Breakpoints<Breakpoint>
): Array<Breakpoint> {
const keys: Array<string> = Object.keys(breakpoints);
return keys.sort(function(a, b) {
return keys.sort(function (a, b) {
return breakpoints[a] - breakpoints[b];
});
}
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export function sortLayoutItems(
*/
export function sortLayoutItemsByRowCol(layout: Layout): Layout {
// Slice to clone array as sort modifies
return layout.slice(0).sort(function(a, b) {
return layout.slice(0).sort(function (a, b) {
if (a.y > b.y || (a.y === b.y && a.x > b.x)) {
return 1;
} else if (a.y === b.y && a.x === b.x) {
Expand All @@ -615,7 +615,7 @@ export function sortLayoutItemsByRowCol(layout: Layout): Layout {
* Does not modify Layout.
*/
export function sortLayoutItemsByColRow(layout: Layout): Layout {
return layout.slice(0).sort(function(a, b) {
return layout.slice(0).sort(function (a, b) {
if (a.x > b.x || (a.x === b.x && a.y > b.y)) {
return 1;
}
Expand Down

0 comments on commit 105a11b

Please sign in to comment.