mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-01-13 17:03:00 +08:00
Add typings for react-facebook-login-component (#29402)
This commit is contained in:
committed by
Wesley Wigham
parent
1e7ac42aa3
commit
2debc8b4cc
25
types/react-facebook-login-component/index.d.ts
vendored
Normal file
25
types/react-facebook-login-component/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for react-facebook-login-component 4.1
|
||||
// Project: https://github.com/kennetpostigo/react-facebook-login-component
|
||||
// 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 FacebookLoginInfo {
|
||||
id: string;
|
||||
accessToken: string;
|
||||
name?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export interface FacebookLoginProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
socialId: string;
|
||||
xfbml?: boolean;
|
||||
version?: string;
|
||||
fields?: string;
|
||||
buttonText?: string;
|
||||
responseHandler: (response: FacebookLoginInfo) => void;
|
||||
}
|
||||
|
||||
export class FacebookLogin extends React.Component<FacebookLoginProps> {}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { FacebookLogin, FacebookLoginInfo } from "react-facebook-login-component";
|
||||
import * as React from "react";
|
||||
|
||||
const handler = (response: FacebookLoginInfo) => {
|
||||
console.log(response.accessToken);
|
||||
};
|
||||
|
||||
const ReactFacebookLoginComponent: JSX.Element = (
|
||||
<FacebookLogin
|
||||
socialId="1234567890000"
|
||||
responseHandler={handler}
|
||||
/>
|
||||
);
|
||||
|
||||
const ReactFacebookLoginComponentAllOptions: JSX.Element = (
|
||||
<FacebookLogin
|
||||
socialId="1234567890000"
|
||||
responseHandler={handler}
|
||||
xfbml
|
||||
version="2.5"
|
||||
fields="email,username"
|
||||
buttonText="Sign in with Facebook"
|
||||
/>
|
||||
);
|
||||
26
types/react-facebook-login-component/tsconfig.json
Normal file
26
types/react-facebook-login-component/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"target": "es6",
|
||||
"jsx": "react",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-facebook-login-component-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-facebook-login-component/tslint.json
Normal file
1
types/react-facebook-login-component/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user