mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definition for react-panelgroup library
This commit is contained in:
parent
cf2baee61a
commit
24f5111c1a
30
types/react-panelgroup/index.d.ts
vendored
Normal file
30
types/react-panelgroup/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for react-panelgroup 1.0.7
|
||||
// Project: https://github.com/DanFessler/react-panelgroup
|
||||
// Definitions by: My Self <https://github.com/qgolsteyn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
/**
|
||||
* Interface used to define a number of options for a panel.
|
||||
*/
|
||||
export interface PanelWidth {
|
||||
size?: number;
|
||||
minSize?: number;
|
||||
resize?: "fixed" | "dynamic" | "stretch";
|
||||
snap?: number[];
|
||||
}
|
||||
|
||||
interface PropTypes {
|
||||
spacing?: number;
|
||||
borderColor?: string;
|
||||
panelColor?: string;
|
||||
direction?: "row" | "column";
|
||||
panelWidths?: Array<PanelWidth | null>;
|
||||
onUpdate?: (data: PanelWidth) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* React component that allows for the creation of resizable panels.
|
||||
*/
|
||||
export default class PanelGroup extends React.Component<PropTypes> {}
|
||||
68
types/react-panelgroup/react-panelgroup-tests.tsx
Normal file
68
types/react-panelgroup/react-panelgroup-tests.tsx
Normal file
@ -0,0 +1,68 @@
|
||||
import PanelGroup, { PanelWidth } from "react-panelgroup";
|
||||
import * as React from "react";
|
||||
|
||||
const test1 = (
|
||||
<PanelGroup>
|
||||
<div>panel 1</div>
|
||||
<div>panel 2</div>
|
||||
<div>panel 3</div>
|
||||
</PanelGroup>
|
||||
);
|
||||
|
||||
const test2 = (
|
||||
<PanelGroup direction="column">
|
||||
<div>panel 1</div>
|
||||
<div>panel 2</div>
|
||||
<div>panel 3</div>
|
||||
</PanelGroup>
|
||||
);
|
||||
|
||||
const test3 = (
|
||||
<PanelGroup direction="row">
|
||||
<PanelGroup direction="column">
|
||||
<div>panel 1</div>
|
||||
<div>panel 2</div>
|
||||
<div>panel 3</div>
|
||||
</PanelGroup>
|
||||
<div>panel 4</div>
|
||||
<PanelGroup direction="column">
|
||||
<div>panel 5</div>
|
||||
<div>panel 6</div>
|
||||
</PanelGroup>
|
||||
</PanelGroup>
|
||||
);
|
||||
|
||||
const test4 = (
|
||||
<PanelGroup
|
||||
panelWidths={[
|
||||
{ size: 100, minSize: 50, resize: "dynamic" },
|
||||
{ minSize: 100, resize: "stretch" },
|
||||
{ size: 100, minSize: 50, resize: "dynamic" }
|
||||
]}
|
||||
>
|
||||
<div>panel 1</div>
|
||||
<div>panel 2</div>
|
||||
<div>panel 3</div>
|
||||
</PanelGroup>
|
||||
);
|
||||
|
||||
const test5 = (
|
||||
<PanelGroup
|
||||
direction="column"
|
||||
borderColor="#FFF"
|
||||
panelColor="#FFF"
|
||||
spacing={12}
|
||||
onUpdate={data => {}}
|
||||
>
|
||||
<div>panel 1</div>
|
||||
<div>panel 2</div>
|
||||
<div>panel 3</div>
|
||||
</PanelGroup>
|
||||
);
|
||||
|
||||
const test6: PanelWidth = {
|
||||
size: 100,
|
||||
minSize: 100,
|
||||
resize: "fixed",
|
||||
snap: [50, 75]
|
||||
};
|
||||
16
types/react-panelgroup/tsconfig.json
Normal file
16
types/react-panelgroup/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"jsx": "react",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-panelgroup-tests.tsx"]
|
||||
}
|
||||
1
types/react-panelgroup/tslint.json
Normal file
1
types/react-panelgroup/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user