ndimatteo / sanity-plugin-note-field

Custom Note Fields for Sanity
MIT License
42 stars 6 forks source link

Optional class/id attribute #9

Open jamestrenda opened 1 year ago

jamestrenda commented 1 year ago

First off, great little plugin!

One small issue. It's purely aesthetic. The way Sanity spaces the fields in the form makes it feel like these notes aren't directly related to the field they're above. I'd like to bring the bottom margin down on these notes, so they look more like they're a part of the field for which they're noting, but there's currently no reliable identifier on the markup to hook into.

Can you please give the outer Card element a specific class name like sanity-plugin-note-field or let us add our own classes to the rendered Card element?

And before you say open a pull request, I probably will not. This seems simple enough to get around to whenever you can get around to it. Correct me if I'm wrong though. Maybe it's not trivial. ¯_(ツ)_/¯

It's a subtle change, but I think it makes a big difference.

Thanks!

ndimatteo commented 1 year ago

Hey there @jamestrenda!

I totally understand your request, however note fields were never intended to be "related" to adjacent fields. They are stand-alone fields, much like any other field you'd add to your schema.

Additionally, the spacing between fields is not controlled by this plugin, but rather by the core Sanity Studio, through the use of a <Stack /> component.

There's no elegant way to provide a negative margin to negate the stack spacing, as that's not a valid value per the Sanity UI specs.

However, I think what I'd be willing to do is add a data-note attribute so that you could more easily target the field via custom CSS.

I can add this in on the next release 🤘