xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 8 forks source link

`ErrorMessage` component should be cross-platform #3693

Open amcclain opened 3 months ago

amcclain commented 3 months ago

We have two versions of the ErrorMessage component - one for desktop, one for mobile. This is problematic for use cases where we have an app-level comp that's cross-platform.

We should migrate to a single cross-platform component or use our "dynamics" concept to support an import that swaps between the two.

lbwexler commented 1 month ago

This is a nice idea -- the code is truly identical. One issue is that the APIs are actually different due to the fact that one gets Mobile ButtonProps and the other gets Desktop ButtonProps. Sigh.

amcclain commented 1 month ago

Yes, exactly - honestly it's frustrating that we have different button components - if I could go back in time doesn't seem like that itself should be necessary (different buttons) but all stemming AFAIK from core use of Blueprint and that library declaring itself desktop-only in general.

Assuming that we don't want to block on an entire rethink of buttons - surely we don't - where does that leave us?

Rethinking this component to avoid buttons entirely seems a bit drastic - we could do something with links instead but that seems like it would just be...weird.

Could we create a new props interface for a very restricted set of cross-platform button props (I really don't think we need to support many - we could keep it limited to e.g. text/icon/onClick + layout/styleProps) and then use the dynamics mechanism to instantiate the right platform-specific errorMsg component?

lbwexler commented 1 month ago

Like the idea of a common interface -- will take a look.