Mrsandesh399 / sundaytech_assignment

0 stars 0 forks source link

Suggestions #1

Open saurabswaarm opened 1 year ago

saurabswaarm commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Login/index.jsx#L54

Avoid redundant classes, col-xs-12 and col-md-6 should suffice.

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Login/loginStyles.css#L8

changing this to height 100% will be better

saurabswaarm commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Login/index.jsx#L23

const {value} = event.target will be enough. Avoid unnecessary destructuring arguments.

saurabswaarm commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Register/index.jsx#L25-L57

running validation twice, you only need to run it once. Just directly access it from the state error object and remove line 45 to 52.


if (errorUserData.emaiId === "" && errorUserData.userName === "" && errorUserData.password === "") {
      localStorage.setItem("registered_user", JSON.stringify(userData));
      navigate("/");
      //localstorageCheck
    }
saurabswaarm commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Register/index.jsx#L132

We need a way to disable submit, please use a global isValid state object to disable submitting.

Mrsandesh399 commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Login/index.jsx#L54

Avoid redundant classes, col-xs-12 and col-md-6 should suffice.

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Login/loginStyles.css#L8

changing this to height 100% will be better

height 100% does not match the given image for desired output width 100% works here

Mrsandesh399 commented 1 year ago

https://github.com/Mrsandesh399/sundaytech_assignment/blob/12afddbe20b486f5e29923549fbb65a1685a3f73/src/Component/Register/index.jsx#L132

We need a way to disable submit, please use a global isValid state object to disable submitting.

error handling is done and error is displayed on invalid entries

saurabswaarm commented 1 year ago

There is code repetition happening for validation. Validation code is being called twice. Your code can be shortened a lot.

If you want to use width:100%, use object-fit property as well.