diff options
author | Rohan Raj Gupta <[email protected]> | 2022-08-12 12:57:43 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2022-08-12 12:57:43 +0530 |
commit | 6d821dc4aa7f6235d2d619dfd8b2954c241f0439 (patch) | |
tree | ca8811c7d708bbb7f3266b9bc1045ee70219f996 /client/src/components | |
parent | 53795fe3153f514e0eda6a01f6e55eeb50c94d46 (diff) | |
parent | 87a343644592e9b425e7fa0805988ad8e7ee8778 (diff) |
Merge pull request #3 from Blaster4385/develop
Refactor code, add country api, switch to multi-step form
Diffstat (limited to 'client/src/components')
-rw-r--r-- | client/src/components/Card/Card.jsx | 4 | ||||
-rw-r--r-- | client/src/components/Input/Input.jsx | 7 | ||||
-rw-r--r-- | client/src/components/Input/Input.module.css | 3 | ||||
-rw-r--r-- | client/src/components/RegEx/RegEx.jsx | 9 | ||||
-rw-r--r-- | client/src/components/SubmitButton/SubmitButton.jsx | 4 |
5 files changed, 21 insertions, 6 deletions
diff --git a/client/src/components/Card/Card.jsx b/client/src/components/Card/Card.jsx index 3d66067..9460955 100644 --- a/client/src/components/Card/Card.jsx +++ b/client/src/components/Card/Card.jsx @@ -1,9 +1,9 @@ import React from 'react' import styles from './Card.module.css' -const Card = ({ title, image }) => { +const Card = ({ title, image, onClick }) => { return ( - <div className={styles.card}> + <div onClick={ onClick } className={styles.card}> <img className={styles.card__image} src={image} alt="" /> <h2 className={styles.card__title}>{title}</h2> </div> diff --git a/client/src/components/Input/Input.jsx b/client/src/components/Input/Input.jsx index 5987e27..08e8fab 100644 --- a/client/src/components/Input/Input.jsx +++ b/client/src/components/Input/Input.jsx @@ -1,7 +1,7 @@ import React from 'react' import styles from './Input.module.css' -const Input = ({ label, id, value, type, name, onChange, placeholder }) => { +const Input = ({ label, id, value, type, name, onChange, placeholder, maxLength, pattern, minLength, onInvalid, onValid }) => { return ( <div className={styles.input}> <div className={styles.input__container}> @@ -15,6 +15,11 @@ const Input = ({ label, id, value, type, name, onChange, placeholder }) => { onChange={onChange} required placeholder={placeholder} + pattern={pattern} + maxLength={maxLength} + minLength={minLength} + onInvalid={onInvalid} + onValid={onValid} /> </div> </div> diff --git a/client/src/components/Input/Input.module.css b/client/src/components/Input/Input.module.css index cafb5f1..b02591c 100644 --- a/client/src/components/Input/Input.module.css +++ b/client/src/components/Input/Input.module.css @@ -13,7 +13,8 @@ .input__field { width: 300px; margin: 10px 0px; - padding: 20px 10px; + padding: 18px 10px; border: 3px solid; border-radius: 10px; + font-size: 1rem; } diff --git a/client/src/components/RegEx/RegEx.jsx b/client/src/components/RegEx/RegEx.jsx new file mode 100644 index 0000000..2df4266 --- /dev/null +++ b/client/src/components/RegEx/RegEx.jsx @@ -0,0 +1,9 @@ +export const validString = /^[a-zA-Z]+$/ + +export const validMobileNumber = /^[0-9]{10}$/ + +export const validNumber = /^[0-9]+$/ + +export const validPincode = /^[0-9]{6}$/ + +export const validEmail = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/ diff --git a/client/src/components/SubmitButton/SubmitButton.jsx b/client/src/components/SubmitButton/SubmitButton.jsx index e1ba305..4437efa 100644 --- a/client/src/components/SubmitButton/SubmitButton.jsx +++ b/client/src/components/SubmitButton/SubmitButton.jsx @@ -1,10 +1,10 @@ import React from 'react' import styles from './SubmitButton.module.css' -const SubmitButton = () => { +const SubmitButton = ({ onClick }) => { return ( <> - <button className={styles.submit} type="submit"> + <button onClick={onClick} className={styles.submit} type="submit"> <img className={styles.submit__image} src={`${process.env.PUBLIC_URL}/assets/images/white-check.svg`} |