Add types for react-add-to-calendar package (#38751)

This commit is contained in:
Konstantin
2019-10-02 13:30:07 -07:00
committed by Ryan Cavanaugh
parent 2ea517f1b6
commit e39fd75419
4 changed files with 96 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for react-add-to-calendar 0.1
// Project: https://github.com/jasonsalzman/react-add-to-calendar
// Definitions by: Konstantin Lebedev <https://github.com/koss-lebedev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
export interface AddToCalendarEvent {
title?: string;
description?: string;
location?: string;
startTime?: string | Date;
endTime?: string | Date;
}
export interface AddToCalendarProps {
buttonClassClosed?: string;
buttonClassOpen?: string;
buttonLabel?: string;
buttonTemplate?: any;
buttonIconClass?: string;
useFontAwesomeIcons?: boolean;
buttonWrapperClass?: string;
displayItemIcons?: boolean;
optionsOpen?: boolean;
dropdownClass?: string;
event: AddToCalendarEvent;
listItems?: any[];
rootClass?: string;
}
declare const ReactAddToCalendar: React.ComponentClass<AddToCalendarProps>;
export default ReactAddToCalendar;
@@ -0,0 +1,34 @@
import AddToCalendar from "react-add-to-calendar";
import * as React from "react";
const sampleEvent = {
title: 'Sample Event',
description: 'This is the sample event provided as an example only',
location: 'Portland, OR',
startTime: '2016-09-16T20:15:00-04:00',
endTime: '2016-09-16T21:45:00-04:00'
};
const AddToCalendarRequiredOptions: JSX.Element = (
<AddToCalendar
event={sampleEvent}
/>
);
const AddToCalendarAllOptions: JSX.Element = (
<AddToCalendar
event={sampleEvent}
buttonClassClosed="test"
buttonClassOpen="test"
buttonLabel="test"
buttonTemplate=""
buttonIconClass="test"
useFontAwesomeIcons={false}
buttonWrapperClass="test"
displayItemIcons={false}
optionsOpen={false}
dropdownClass="test"
listItems={[]}
rootClass="test"
/>
);
+26
View 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-add-to-calendar-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }