Skip to content
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

Selectbox component needs refactoring #140

Open
Lonelind opened this issue Jun 27, 2019 · 0 comments
Open

Selectbox component needs refactoring #140

Lonelind opened this issue Jun 27, 2019 · 0 comments

Comments

@Lonelind
Copy link

I was trying to implement custom Selectbox with icons instead of text and faced a lot of design problems:

  1. The styling for the component is completely solid. You can't separate it into different css modules like it's implemented in other components (NumericStepper, for example). That leads us into the problem I faced: when you need to overload the Anchor, you need to use theme prop, that depends on theme you provide inside the Selectbox and create themable component.
  2. Selectbox's onValueChange handler accepts string | number | undefined type and I need to implement the function with the same signature and then cast/check types. Maybe, generics here could work better. For example, I could use string literals union type to represent my options, and I'm eager to work with this and only this set of values.
  3. The Anchor component accepts value prop as ReactText type. In my case I expect it to be just string or string literal, as soon as I'm overloading the Anchor component. So again, I need to cast types there, but it could also be generic like I mentioned above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants