@wecodesolutions/shared-react-components-ts 0.12.0 → 0.12.2
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/dist/components/buttons/SignInWithGoogle/SignInWithGoogle.d.ts +1 -1
- package/dist/components/passwordInput/PasswordInput.d.ts +1 -0
- package/dist/shared-react-components-ts.cjs.development.js +20 -17
- package/dist/shared-react-components-ts.cjs.development.js.map +1 -1
- package/dist/shared-react-components-ts.cjs.production.min.js +1 -1
- package/dist/shared-react-components-ts.cjs.production.min.js.map +1 -1
- package/dist/shared-react-components-ts.esm.js +20 -17
- package/dist/shared-react-components-ts.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/bottomNavBar/BottomNavBar.module.css +0 -1
- package/src/components/bottomNavBar/BottomNavBar.tsx +27 -24
- package/src/components/buttons/IBtnOption.ts +9 -11
- package/src/components/buttons/SignInWithGoogle/SignInWithGoogle.module.css +0 -2
- package/src/components/buttons/SignInWithGoogle/SignInWithGoogle.tsx +50 -27
- package/src/components/buttons/button/Button.tsx +18 -13
- package/src/components/buttons/circleButton/CircleButton.tsx +11 -8
- package/src/components/buttons/roundButton/RoundButton.tsx +7 -7
- package/src/components/card/Card.tsx +29 -25
- package/src/components/formContainer/FormContainer.tsx +20 -20
- package/src/components/icons/AllCustomIcons.tsx +74 -25
- package/src/components/inputField/InputField.tsx +45 -40
- package/src/components/navBar/NavBar.module.css +0 -1
- package/src/components/navBar/NavBar.tsx +52 -37
- package/src/components/passwordInput/PasswordInput.tsx +45 -38
- package/src/components/protectedRoute/ProtectedRoute.tsx +7 -5
- package/src/components/validationMessage/ValidationMessage.tsx +15 -10
- package/src/global.d.ts +3 -3
- package/src/index.tsx +1 -1
|
@@ -2,48 +2,55 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import styles from './PasswordInput.module.css'; // Import the CSS module
|
|
3
3
|
|
|
4
4
|
interface PasswordInputProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
label?: string; // Label for the input
|
|
6
|
+
placeholder?: string; // Placeholder text
|
|
7
|
+
value: string; // Controlled value
|
|
8
|
+
onChange: (value: string) => void; // Change handler
|
|
9
|
+
autoFill?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const PasswordInput: React.FC<PasswordInputProps> = ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
label = 'Password',
|
|
14
|
+
placeholder = 'Enter your password',
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
autoFill = true,
|
|
16
18
|
}) => {
|
|
17
|
-
|
|
19
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const togglePasswordVisibility = () => {
|
|
22
|
+
setIsPasswordVisible(!isPasswordVisible);
|
|
23
|
+
};
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.container}>
|
|
27
|
+
{label && <label className={styles.label}>{label}</label>}
|
|
28
|
+
<div className={styles.wrapper}>
|
|
29
|
+
<input
|
|
30
|
+
type={isPasswordVisible ? 'text' : 'password'}
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={e => onChange(e.target.value)}
|
|
33
|
+
placeholder={placeholder}
|
|
34
|
+
className={styles.input}
|
|
35
|
+
autoComplete={autoFill ? 'on' : 'off'}
|
|
36
|
+
/>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
className={styles.toggle}
|
|
40
|
+
onClick={togglePasswordVisibility}
|
|
41
|
+
aria-label={isPasswordVisible ? 'Hide password' : 'Show password'}
|
|
42
|
+
>
|
|
43
|
+
{isPasswordVisible ? (
|
|
44
|
+
<span role="img" aria-label="Hide">
|
|
45
|
+
👁️
|
|
46
|
+
</span>
|
|
47
|
+
) : (
|
|
48
|
+
<span role="img" aria-label="Show">
|
|
49
|
+
🙈
|
|
50
|
+
</span>
|
|
51
|
+
)}
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
49
56
|
};
|
|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import { Navigate } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
interface ProtectedRouteProps {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
children: JSX.Element;
|
|
7
|
+
isAuthenticated: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
|
11
|
-
|
|
10
|
+
export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
|
11
|
+
children,
|
|
12
|
+
isAuthenticated = false,
|
|
13
|
+
}) => {
|
|
14
|
+
return isAuthenticated ? children : <Navigate to="/" replace />;
|
|
12
15
|
};
|
|
13
|
-
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
interface ValidationMessageProps {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
message: string;
|
|
5
|
+
type: 'error' | 'success' | 'info';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const ValidationMessage: React.FC<ValidationMessageProps> = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
export const ValidationMessage: React.FC<ValidationMessageProps> = ({
|
|
9
|
+
message,
|
|
10
|
+
type,
|
|
11
|
+
}) => {
|
|
12
|
+
const colorSpan = {
|
|
13
|
+
color: `${type === 'error' ? 'red' : type === 'info' ? 'blue' : 'black'}`,
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<span style={colorSpan} className={`validation-message ${type}`}>
|
|
17
|
+
{message}
|
|
18
|
+
</span>
|
|
19
|
+
);
|
|
20
|
+
};
|
package/src/global.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare module '*.module.css' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
const classes: { [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -10,4 +10,4 @@ export * from './components/inputField/InputField';
|
|
|
10
10
|
export * from './components/navBar/NavBar';
|
|
11
11
|
export * from './components/passwordInput/PasswordInput';
|
|
12
12
|
export * from './components/protectedRoute/ProtectedRoute';
|
|
13
|
-
export * from './components/validationMessage/ValidationMessage';
|
|
13
|
+
export * from './components/validationMessage/ValidationMessage';
|