nandorojo / dripsy

🍷 Responsive, unstyled UI primitives for React Native + Web.
https://dripsy.xyz
MIT License
2.01k stars 80 forks source link

Define custom shorthands / aliases #261

Closed jaivinwylde closed 1 year ago

jaivinwylde commented 1 year ago

Are there any plans to allow for defining custom shorthands (aliases)?

What would need to be added to get this to work? I'm not familiar with the codebase, but I could try making a PR.

nandorojo commented 1 year ago

It's certainly possible, and could be added in the next version. Currently, Dripsy uses the alias variable I believe to define shorthands. So we'd need a way to pass that to the theme. Next, since our types currently read this alias variable statically, we'd need to merge that value with the one passed to our theme. Finally, we'd need to consume the user's shorthands in the actual dripsy hook by merging it with alias, which again, should be straightforward.

nandorojo commented 1 year ago

The only issue is that the Dripsy internals are a bit of a mess but I do think this is a good idea.

jaivinwylde commented 1 year ago

What do you think about adding tamagui's shorthands to the alias variable in the meantime? They have a lot of sane defaults that cover almost all of the styles that people often use.

nandorojo commented 1 year ago

if you point me to the file i can do that

nandorojo commented 1 year ago

but ideally i’d accept a PR

jaivinwylde commented 1 year ago

on it

jaivinwylde commented 1 year ago

I added tamagui's shorthands, but I think it makes sense to keep this issue open since the custom shorthands feature hasn't been added yet

nandorojo commented 1 year ago

This will be much easier to add with the upcoming release of v4, which has much cleaner types.

https://github.com/nandorojo/dripsy/releases/tag/v4.0.0

nandorojo commented 1 year ago

theme.aliases implemented in v4.