-
Notifications
You must be signed in to change notification settings - Fork 867
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
Potential improvements to address prop to make it more customizable #773
Potential improvements to address prop to make it more customizable #773
Conversation
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.
Thanks for the idea @Hotmanics
Let us play with it a little bit. A few comments from a first look:
- We should try to standardize with the rest of the components (Balance, etc)
- The prop
size
is not being used in your changes and it's changing the look of existing components that use a different size. (e.g.TransactionTable.tsx
) wrapperClasses
might be a better name thancardClasses
@@ -16,6 +16,8 @@ type AddressProps = { | |||
disableAddressLink?: boolean; | |||
format?: "short" | "long"; | |||
size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl"; | |||
textClasses?: string; | |||
cardClasses?: string; |
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.
I think it's better to name props textClassName
and cardClassName
similar to base className
prop
@Hotmanics , thanks for your fast response! Some additional points. I'm thinking do we really need wrapperClassName but still not sure your example
pros
cons
Also noticed that when changing Not sure if it planned behavior or not. So it looks like these
Looks like for both cases you could use just needed wrapper div
What do you think? |
I see. I guess my React fundamentals were off point here which may invalidate most of the points of the PR. It never occurred to me that I could just wrap the component into an enclosing div to achieve the same result. That seems moreso the proper way to accomplish the customizability I am seeking. Are there any restrictions using this approach? I do think the properties of the image, text, and copy button should be customizable and independant of eachother if the developer chooses so. Gonna work on some commits to achieve that and will ping when I get an example made up. |
Ok...so i think there still may be a need to define the wrapper class as something other than the hardcoded There is now The philosophy is: Here is an example implementation of both of the components. You can see This example demonstrates the ability to stack each element and customize them as well if the developer desires that for their application. This was previously not possible. It will be more work and require more understanding on their part, but thats the price of customization IMO. Thoughts and feedback? @rin-st |
Thanks for the changes!
A little bit 🙂 . Probably it's my bad since I wasn't clear what we need to do. And I thought to discuss first before writing code.
|
Not your bad at all! My coding style is code first, ask questions later.
I'm sure we can find some scenarios if we think hard enough. The one that comes to mind is the example shown above where they are vertical. For example, you can have a page full of "profiles" in that fashion, rather than a list of, what feels to me, like "widgets". I think user complexity can stay fairly simple if not the same through the introduction of "ScaffoldAddress", which is the component that fits 95% of scenarios (Pretty much what the original "Address" component is). Then, if they want to dig deeper and explore a customizable option, then that option exists. It may not be easier, but they do have the option. Albeit, yes this does add more code management and complexity to the template repository that may not be needed.
Thus, "ScaffoldAddress". As "Address" currently stands, there is little need to have those options, but once you start allowing customizations, then I can personally see a situation where there is small text and a large copy icon.
If it's not clear, I'm obviously for as much customization as possible. I just ask the question "Why not?" The only reason that comes to mind in this situation is that it adds more complexity and management on the Repo's side. |
I agree that the customizing is great! But for me, mastering is to use minimal possible props that are enough for most cases. And add new props only when required. Like in your case: you need the possibility to update styles - you create pr with the functionality needed.
I think it's a big reason :) Let's wait a bit what others think, but it can take time since part of core contributors are at EthLondon |
++ Thanks so much @Hotmanics for this !! Just created #786 out of this discussion, I think it's better if we first discuss their and then tackle this. Since then will have a better picture and also in line with considering other components 🙌 Really feel bad for closing this :( and appreciate the hard work but that's why we have this note while creating the PR : But thanks again for contribution!! This led us to #786 and we could totally re-open this after #786 if we feel this is the way to go 🙌! |
Description
Address.tsx updates that allow for better customization of the card while retaining default values that work out of the box.
Address.tsx continued...
Possible usage of customizing the address card in an implementation.
Possible result of the implementation's customizations
Additional Information
Your ENS/address: JacobHomanics.eth