-
Notifications
You must be signed in to change notification settings - Fork 4
update any instance of address validation to use InputAddress #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| isValid, | ||
| onChange, | ||
| className = "", | ||
| readOnly = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add className to add classes needed for situational positioning/styling and readOnly to render a disabled input
| <input | ||
| style={{ height: 48 }} | ||
| className="border-light rounded-sm column is-full p-2 mt-2" | ||
| className="border-light rounded-sm column is-full p-4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved p-2 => p-4 to match designs closer / be consistent throughout app
| <div style={{ position: "absolute", right: 17, top: 20 }}> | ||
| <div | ||
| className="is-flex is-align-items-center" | ||
| style={{ position: "absolute", right: 15, top: 0, height: "100%" }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a container with 100% height thats align-items: center which should be more flexible than fixed absolute positioning
| )} | ||
| </div> | ||
| <InputAddress | ||
| className={addressValidClass} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this addressValidClass depends if the address is valid, so that logic can be moved to InputAddress?
This way we can ensure all the inputs have is-success/is-error class attached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KsenijaZivkovic good call - added!
| const onOwnerAddressChange = (value, isValid, idx) => { | ||
| const newOwners = safeOwners.slice(0); | ||
| newOwners[idx].address = value; | ||
| newOwners[idx].isValid = isValid; | ||
| setSafeOwners([...newOwners]); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer following the style guide
| const onOwnerAddressChange = (value, isValid, idx) => { | |
| const newOwners = safeOwners.slice(0); | |
| newOwners[idx].address = value; | |
| newOwners[idx].isValid = isValid; | |
| setSafeOwners([...newOwners]); | |
| }; | |
| const onOwnerAddressChange = (value, isValid, idx) => { | |
| const newOwners = [...safeOwners] | |
| newOwners[idx].address = value; | |
| newOwners[idx].isValid = isValid; | |
| setSafeOwners(newOwners); | |
| }; |
| )} | ||
| </div> | ||
| </div> | ||
| <InputAddress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This input Address component is being replaced by addressDropdown. I think we can safely delete this file now https://github.com/DapperCollectives/VESSEL/pull/120/files#diff-e8e43eadee51d689965c6c2bd4a914f301aea66e12351d018baa6cd3567d1422
|
|
||
| const InputAddress = ({ web3, value, isValid, onChange }) => { | ||
| const InputAddress = ({ | ||
| web3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need web3 as a prop when we expect isValid and onChange to handle the validation?
131d99b to
1b7f4c2
Compare
1b7f4c2 to
bb2ec7c
Compare

Description
We have several places in our app where we have an input for FLOW addresses which we want to validate against the FLOW blockchain and sometimes run additional validation logic on it. This PR moves all those custom
<input>to use our shared<InputAddress>so styling is consistent and to minimize places to update.Demo / Test Result