mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Add typings for react-google-login-component (#29467)
This commit is contained in:
committed by
Wesley Wigham
parent
939bed73a7
commit
f17caa9fa6
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for react-google-login-component 0.9
|
||||
// Project: https://github.com/kennetpostigo/react-google-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 GoogleLoginInfo {
|
||||
getAuthResponse: () => {
|
||||
access_token: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GoogleLoginProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
socialId: string;
|
||||
scope?: string;
|
||||
fetchBasicProfile?: boolean;
|
||||
buttonText?: string;
|
||||
prompt?: string;
|
||||
responseHandler: (response: GoogleLoginInfo) => void;
|
||||
}
|
||||
|
||||
export class GoogleLogin extends React.Component<GoogleLoginProps> {}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { GoogleLogin, GoogleLoginInfo } from "react-google-login-component";
|
||||
import * as React from "react";
|
||||
|
||||
const handler = (response: GoogleLoginInfo) => {
|
||||
console.log(response.getAuthResponse().access_token);
|
||||
};
|
||||
|
||||
const ReactGoogleLoginComponent: JSX.Element = (
|
||||
<GoogleLogin
|
||||
socialId="1234567890000"
|
||||
responseHandler={handler}
|
||||
/>
|
||||
);
|
||||
|
||||
const ReactGoogleLoginComponentAllOptions: JSX.Element = (
|
||||
<GoogleLogin
|
||||
socialId="1234567890000"
|
||||
responseHandler={handler}
|
||||
scope="profile"
|
||||
fetchBasicProfile
|
||||
prompt="select_account"
|
||||
buttonText="Sign in with Google"
|
||||
/>
|
||||
);
|
||||
@@ -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-google-login-component-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user