Skip to content

Commit 4262093

Browse files
franklixuefeiokonet
authored andcommitted
feat: Create Typescript definitions (#51)
* [Typescript] Created Typescript definitions * Update index.d.ts
1 parent ff18f61 commit 4262093

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

index.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import * as React from 'react';
2+
3+
export interface Dimensions {
4+
top: number;
5+
right: number;
6+
bottom: number;
7+
left: number;
8+
width: number;
9+
height: number;
10+
}
11+
12+
export interface ContainerDimensionsProps {
13+
/**
14+
* Can either be a function that's responsible for rendering children.
15+
* This function should implement the following signature:
16+
* ({ height, width }) => PropTypes.element
17+
* Or a React element, with width and height injected into its props.
18+
*/
19+
children: ((props: Dimensions) => React.ReactNode) | React.ReactNode;
20+
}
21+
22+
/**
23+
* Component that automatically adjusts the width and height of a single child.
24+
* Child component should not be declared as a child but should rather be specified by a `ChildComponent` property.
25+
* All other properties will be passed through to the child component.
26+
*/
27+
declare const ContainerDimensions: React.ComponentType<ContainerDimensionsProps>;
28+
export default ContainerDimensions;

0 commit comments

Comments
 (0)