@wecodesolutions/shared-react-components-ts 0.5.1 → 0.5.3

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.
@@ -0,0 +1,106 @@
1
+ .gsiMaterialButton {
2
+ -moz-user-select: none;
3
+ -webkit-user-select: none;
4
+ -ms-user-select: none;
5
+ -webkit-appearance: none;
6
+ background-color: WHITE;
7
+ background-image: none;
8
+ border: 1px solid #747775;
9
+ -webkit-border-radius: 20px;
10
+ border-radius: 20px;
11
+ -webkit-box-sizing: border-box;
12
+ box-sizing: border-box;
13
+ color: #1f1f1f;
14
+ cursor: pointer;
15
+ font-family: 'Roboto', arial, sans-serif;
16
+ font-size: 14px;
17
+ height: 40px;
18
+ letter-spacing: 0.25px;
19
+ outline: none;
20
+ overflow: hidden;
21
+ padding: 0 12px;
22
+ position: relative;
23
+ text-align: center;
24
+ -webkit-transition: background-color 0.218s, border-color 0.218s,
25
+ box-shadow 0.218s;
26
+ transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s;
27
+ vertical-align: middle;
28
+ white-space: nowrap;
29
+ width: auto;
30
+ max-width: 400px;
31
+ min-width: min-content;
32
+ }
33
+
34
+ .gsiMaterialButtonIcon {
35
+ height: 20px;
36
+ margin-right: 12px;
37
+ min-width: 20px;
38
+ width: 20px;
39
+ }
40
+
41
+ .gsiMaterialButtonContentWrapper {
42
+ -webkit-align-items: center;
43
+ align-items: center;
44
+ display: flex;
45
+ -webkit-flex-direction: row;
46
+ flex-direction: row;
47
+ -webkit-flex-wrap: nowrap;
48
+ flex-wrap: nowrap;
49
+ height: 100%;
50
+ justify-content: space-between;
51
+ position: relative;
52
+ width: 100%;
53
+ }
54
+
55
+ .gsiMaterialButtonContents {
56
+ -webkit-flex-grow: 1;
57
+ flex-grow: 1;
58
+ font-family: 'Roboto', arial, sans-serif;
59
+ font-weight: 500;
60
+ overflow: hidden;
61
+ text-overflow: ellipsis;
62
+ vertical-align: top;
63
+ }
64
+
65
+ .gsiMaterialButtonState {
66
+ -webkit-transition: opacity 0.218s;
67
+ transition: opacity 0.218s;
68
+ bottom: 0;
69
+ left: 0;
70
+ opacity: 0;
71
+ position: absolute;
72
+ right: 0;
73
+ top: 0;
74
+ }
75
+
76
+ .gsiMaterialButton:disabled {
77
+ cursor: default;
78
+ background-color: #ffffff61;
79
+ border-color: #1f1f1f1f;
80
+ }
81
+
82
+ .gsiMaterialButton:disabled .gsiMaterialButtonContents {
83
+ opacity: 38%;
84
+ }
85
+
86
+ .gsiMaterialButton:disabled .gsiMaterialButtonIcon {
87
+ opacity: 38%;
88
+ }
89
+
90
+ .gsiMaterialButton:not(:disabled):active .gsiMaterialButtonState,
91
+ .gsiMaterialButton:not(:disabled):focus .gsiMaterialButtonState {
92
+ background-color: #303030;
93
+ opacity: 12%;
94
+ }
95
+
96
+ .gsiMaterialButton:not(:disabled):hover {
97
+ -webkit-box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
98
+ 0 1px 3px 1px rgba(60, 64, 67, 0.15);
99
+ box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
100
+ 0 1px 3px 1px rgba(60, 64, 67, 0.15);
101
+ }
102
+
103
+ .gsiMaterialButton:not(:disabled):hover .gsiMaterialButtonState {
104
+ background-color: #303030;
105
+ opacity: 8%;
106
+ }
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import styles from "./SignInWithGoogle.module.css";
3
+ import { Auth, GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
4
+
5
+ interface SignInWithGoogleProps {
6
+ auth: Auth
7
+ }
8
+
9
+ export const SignInWithGoogle: React.FC<SignInWithGoogleProps> = ({ auth }) => {
10
+
11
+ function googleLogin(auth: Auth) {
12
+ const provider = new GoogleAuthProvider();
13
+ signInWithPopup(auth, provider).then(async (result) => {
14
+ console.log(result);
15
+ });
16
+ }
17
+
18
+ return (
19
+ <button
20
+ className={styles.gsiMaterialButton}
21
+ onClick={(event) => {
22
+ event.preventDefault(); // Prevent form submission
23
+ googleLogin(auth);
24
+ }}>
25
+ <div className={styles.gsiMaterialButtonState}></div>
26
+ <div className={styles.gsiMaterialButtonContentWrapper}>
27
+ <div className={styles.gsiMaterialButtonIcon}>
28
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" xmlnsXlink="http://www.w3.org/1999/xlink" style={{ display: "block" }}>
29
+ <path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"></path>
30
+ <path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"></path>
31
+ <path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"></path>
32
+ <path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"></path>
33
+ <path fill="none" d="M0 0h48v48H0z"></path>
34
+ </svg>
35
+ </div>
36
+ <span className={styles.gsiMaterialButtonContents}>Continue with Google</span>
37
+ <span style={{ display: "none" }}>Continue with Google</span>
38
+ </div>
39
+ </button>
40
+ );
41
+ };
package/src/index.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './components/buttons/button/Button';
2
2
  export * from './components/buttons/circleButton/CircleButton';
3
- export * from './components/buttons/googleLoginComponent/GoogleLoginComponent';
4
3
  export * from './components/buttons/roundButton/RoundButton';
4
+ export * from './components/buttons/SignInWithGoogle/SignInWithGoogle';
5
5
  export * from './components/formContainer/FormContainer';
6
6
  export * from './components/icons/AllCustomIcons';
7
7
  export * from './components/inputField/InputField';
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { GoogleLoginResponse, GoogleLoginResponseOffline } from "react-google-login";
3
- interface GoogleLoginComponentProps {
4
- clientId?: string;
5
- buttonText?: string;
6
- onSuccess?: (response: GoogleLoginResponse | GoogleLoginResponseOffline) => void;
7
- onFailure?: (error: any) => void;
8
- }
9
- export declare const GoogleLoginComponent: React.FC<GoogleLoginComponentProps>;
10
- export {};
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- import { GoogleLogin, GoogleLoginResponse, GoogleLoginResponseOffline } from "react-google-login";
3
-
4
-
5
- interface GoogleLoginComponentProps {
6
- clientId?: string;
7
- buttonText?: string;
8
- onSuccess?: (response: GoogleLoginResponse | GoogleLoginResponseOffline) => void;
9
- onFailure?: (error: any) => void;
10
- }
11
-
12
- export const GoogleLoginComponent: React.FC<GoogleLoginComponentProps> = ({
13
- clientId = "YOUR_GOOGLE_CLIENT_ID", // Default clientId
14
- buttonText = "Continue with Google", // Default button text
15
- onSuccess = (response) => console.log("Login Success!", response), // Default onSuccess handler
16
- onFailure = (error) => console.error("Login Failed!", error), // Default onFailure handler
17
- }) => {
18
-
19
-
20
- return (
21
- <div>
22
- <GoogleLogin
23
- clientId={clientId}
24
- buttonText={buttonText}
25
- onSuccess={onSuccess}
26
- onFailure={onFailure}
27
- cookiePolicy={"single_host_origin"}
28
- style={{ marginTop: "100px" }}
29
- />
30
- </div>
31
- );
32
- };