mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add Types for react-countdown-circle-timer 1.0.3 (#40724)
* Add Types for react-countdown-circle-timer 1.0.3 * Fixed Definition * Fixed Test
This commit is contained in:
parent
f1e572c94d
commit
ce5ef64de9
28
types/react-countdown-circle-timer/index.d.ts
vendored
Normal file
28
types/react-countdown-circle-timer/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for react-countdown-circle-timer 1.0
|
||||
// Project: https://github.com/vydimitrov/react-countdown-circle-timer
|
||||
// Definitions by: Tim Ittermann <https://github.com/timia2109>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.6
|
||||
|
||||
import { Component, ReactNode } from 'react';
|
||||
|
||||
export type ColorType = ReadonlyArray<[ string, number? ]>;
|
||||
export type StrokeLinecapType = "round" | "square";
|
||||
export type RenderTimeFunctionType = (remainingTime: number, elapsedTime: number, isPlaying: boolean) => ReactNode;
|
||||
export type OnCompleteFunctionType = () => [boolean, number] | undefined | void;
|
||||
|
||||
export class CountdownCircleTimer extends Component<Props> {}
|
||||
|
||||
export interface Props {
|
||||
durationSeconds: number;
|
||||
colors: ColorType;
|
||||
size?: number;
|
||||
strokeWidth?: number;
|
||||
strokeLinecap?: StrokeLinecapType;
|
||||
trailColor?: string;
|
||||
isPlaying?: boolean;
|
||||
isLinearGradient?: boolean;
|
||||
gradientUniqueKey?: string;
|
||||
renderTime?: RenderTimeFunctionType;
|
||||
onComplete?: OnCompleteFunctionType;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
import * as React from "react";
|
||||
import { CountdownCircleTimer } from "react-countdown-circle-timer";
|
||||
|
||||
const Test: React.FC = () => {
|
||||
return <CountdownCircleTimer
|
||||
isPlaying
|
||||
durationSeconds={10}
|
||||
colors={[
|
||||
['#004777', .33],
|
||||
['#F7B801', .33],
|
||||
['#A30000']
|
||||
]}
|
||||
size={200}
|
||||
strokeWidth={5}
|
||||
strokeLinecap="round"
|
||||
trailColor="#3f3f3f"
|
||||
isLinearGradient
|
||||
gradientUniqueKey="myKey"
|
||||
renderTime={(r, e, p) => <h1>Test</h1>}
|
||||
onComplete={() => { }}
|
||||
/>;
|
||||
};
|
||||
24
types/react-countdown-circle-timer/tsconfig.json
Normal file
24
types/react-countdown-circle-timer/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-countdown-circle-timer-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-countdown-circle-timer/tslint.json
Normal file
1
types/react-countdown-circle-timer/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user