You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to implement custom Selectbox with icons instead of text and faced a lot of design problems:
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.
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.
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.
The text was updated successfully, but these errors were encountered:
I was trying to implement custom
Selectbox
with icons instead of text and faced a lot of design problems:NumericStepper
, for example). That leads us into the problem I faced: when you need to overload theAnchor
, you need to usetheme
prop, that depends on theme you provide inside theSelectbox
and create themable component.Selectbox
'sonValueChange
handler acceptsstring | 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.Anchor
component acceptsvalue
prop asReactText
type. In my case I expect it to be just string or string literal, as soon as I'm overloading theAnchor
component. So again, I need to cast types there, but it could also be generic like I mentioned above.The text was updated successfully, but these errors were encountered: