forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types for react-add-to-calendar package (DefinitelyTyped#38751)
- Loading branch information
1 parent
2ea517f
commit e39fd75
Showing
4 changed files
with
96 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,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; |
34 changes: 34 additions & 0 deletions
34
types/react-add-to-calendar/react-add-to-calendar-tests.tsx
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,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" | ||
/> | ||
); |
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,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" | ||
] | ||
} |
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 @@ | ||
{ "extends": "dtslint/dt.json" } |