login-signup-google 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "login-signup-google",
3
+ "version": "1.0.0",
4
+ "description": "Reusable React Login, Signup and Google Login components",
5
+ "main": "src/index.js",
6
+ "keywords": ["react", "login", "signup", "google-auth"],
7
+ "author": "Your Name",
8
+ "license": "MIT",
9
+
10
+ "peerDependencies": {
11
+ "react": ">=18"
12
+ }
13
+ }
@@ -0,0 +1,26 @@
1
+ // src/GoogleLogin.jsx
2
+ import { useEffect } from "react";
3
+
4
+ export default function GoogleLogin({ clientId, onSuccess }) {
5
+ useEffect(() => {
6
+ const script = document.createElement("script");
7
+ script.src = "https://accounts.google.com/gsi/client";
8
+ script.async = true;
9
+ script.defer = true;
10
+ document.body.appendChild(script);
11
+
12
+ script.onload = () => {
13
+ window.google.accounts.id.initialize({
14
+ client_id: clientId,
15
+ callback: onSuccess,
16
+ });
17
+
18
+ window.google.accounts.id.renderButton(
19
+ document.getElementById("googleBtn"),
20
+ { theme: "outline", size: "large" }
21
+ );
22
+ };
23
+ }, [clientId, onSuccess]);
24
+
25
+ return <div id="googleBtn"></div>;
26
+ }
package/src/Login.jsx ADDED
@@ -0,0 +1,12 @@
1
+ // src/Login.jsx
2
+ export default function Login({ onLogin }) {
3
+ return (
4
+ <div>
5
+ <h3>Login</h3>
6
+ <input placeholder="Email" />
7
+ <input type="password" placeholder="Password" />
8
+ <button onClick={onLogin}>Login</button>
9
+ </div>
10
+ );
11
+ }
12
+
package/src/Signup.jsx ADDED
@@ -0,0 +1,12 @@
1
+ // src/Signup.jsx
2
+ export default function Signup({ onSignup }) {
3
+ return (
4
+ <div>
5
+ <h3>Signup</h3>
6
+ <input placeholder="Email" />
7
+ <input type="password" placeholder="Password" />
8
+ <button onClick={onSignup}>Signup</button>
9
+ </div>
10
+ );
11
+ }
12
+
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // src/index.js
2
+ export { default as Login } from "./Login";
3
+ export { default as Signup } from "./Signup";
4
+ export { default as GoogleLogin } from "./GoogleLogin";