ZheyangSong
2017-07-27 08:03:46 -07:00
committed by Andy
parent 26e81f5e87
commit 41e137c8e9
2 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
// Type definitions for react-grid-layout 0.14
// Project: https://github.com/STRML/react-grid-layout
// Definitions by: Andrew Birkholz <https://github.com/abirkholz>, Ali Taheri <https://github.com/alitaheri>
// Definitions by: Andrew Birkholz <https://github.com/abirkholz>,
// Ali Taheri <https://github.com/alitaheri>,
// Zheyang Song <https://github.com/ZheyangSong>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -78,7 +80,7 @@ declare namespace ReactGridLayout {
}
type Layouts = {
[P in Breakpoints]: Layout;
[P in Breakpoints]?: Layout[];
};
type ItemCallback = (
@@ -250,7 +252,7 @@ declare namespace ReactGridLayout {
/**
* layouts is an object mapping breakpoints to layouts.
*
* e.g. `{lg: Layout, md: Layout, ...}`
* e.g. `{lg: Layout[], md: Layout[], ...}`
*/
layouts?: Layouts;

View File

@@ -31,8 +31,17 @@ class DefaultGridTest extends React.Component {
class ResponsiveGridTest extends React.Component {
render() {
const layouts = {
lg: [
{ i: '1', x: 0, y: 0, w: 1, h: 2, static: true },
{ i: '2', x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 },
{ i: '3', x: 4, y: 0, w: 1, h: 2 }
]
};
return (
<Responsive
layouts={layouts}
width={800}
breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
cols={{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }}