mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-01-12 22:46:38 +08:00
Add typings for react-sticky-box package (#29534)
This commit is contained in:
22
types/react-sticky-box/index.d.ts
vendored
Normal file
22
types/react-sticky-box/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for react-sticky-box 0.7
|
||||
// Project: https://github.com/codecks-io/react-sticky-box
|
||||
// Definitions by: Konstantin Lebedev <https://github.com/koss-lebedev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
declare namespace ReactStickyBox {
|
||||
type StickyBoxMode = 'relative' | 'stickyBottom' | 'stickyTop';
|
||||
|
||||
interface StickyBoxProps {
|
||||
bottom?: boolean;
|
||||
offsetTop?: number;
|
||||
offsetBottom?: number;
|
||||
onChangeMode?: (oldMode: StickyBoxMode, newMode: StickyBoxMode) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ReactStickyBox: React.ComponentClass<ReactStickyBox.StickyBoxProps>;
|
||||
|
||||
export = ReactStickyBox;
|
||||
19
types/react-sticky-box/react-sticky-box-tests.tsx
Normal file
19
types/react-sticky-box/react-sticky-box-tests.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import ReactStickyBox, { StickyBoxMode } from "react-sticky-box";
|
||||
import * as React from "react";
|
||||
|
||||
const ReactStickyBoxRequiredOptions: JSX.Element = (
|
||||
<ReactStickyBox />
|
||||
);
|
||||
|
||||
const changeHandler = (oldMode: StickyBoxMode, newMode: StickyBoxMode) => {
|
||||
console.log(`Changing from ${oldMode} to ${newMode}`);
|
||||
};
|
||||
|
||||
const ReactStickyBoxAllOptions: JSX.Element = (
|
||||
<ReactStickyBox
|
||||
bottom
|
||||
offsetBottom={20}
|
||||
offsetTop={10}
|
||||
onChangeMode={changeHandler}
|
||||
/>
|
||||
);
|
||||
26
types/react-sticky-box/tsconfig.json
Normal file
26
types/react-sticky-box/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-sticky-box-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-sticky-box/tslint.json
Normal file
1
types/react-sticky-box/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user