-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create Typescript definitions (#51)
* [Typescript] Created Typescript definitions * Update index.d.ts
- Loading branch information
1 parent
ff18f61
commit 4262093
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as React from 'react'; | ||
|
||
export interface Dimensions { | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
left: number; | ||
width: number; | ||
height: number; | ||
} | ||
|
||
export interface ContainerDimensionsProps { | ||
/** | ||
* Can either be a function that's responsible for rendering children. | ||
* This function should implement the following signature: | ||
* ({ height, width }) => PropTypes.element | ||
* Or a React element, with width and height injected into its props. | ||
*/ | ||
children: ((props: Dimensions) => React.ReactNode) | React.ReactNode; | ||
} | ||
|
||
/** | ||
* Component that automatically adjusts the width and height of a single child. | ||
* Child component should not be declared as a child but should rather be specified by a `ChildComponent` property. | ||
* All other properties will be passed through to the child component. | ||
*/ | ||
declare const ContainerDimensions: React.ComponentType<ContainerDimensionsProps>; | ||
export default ContainerDimensions; |