usds / us-forms-system

Build React forms with JSON Schema and the U.S. Web Design System
Other
140 stars 34 forks source link

Looking for a way to customize beforeText, afterText props #335

Closed easherma closed 5 years ago

easherma commented 5 years ago

Is your feature request related to a problem? Please describe. before and afterText props have some props that cannot be easily removed or customized at the moment. For instance, at the moment they have arrow icons being used for progress/form navigation. However, I don't see this anywhere in the USWDS spec, and either way I ought to be able to customize this.

Describe the solution you'd like Use the form system configuration to be able to set button props to something custom (or nothing).

Additional context https://github.com/usds/us-forms-system/blob/ffd15c43556ab4108c1481b8d6163c8a1589a1ea/src/js/components/ProgressButton.jsx#L15

Thanks!

dmethvin-gov commented 5 years ago

It would be nice to avoid having to define and pass through a bunch of optional positional layout control options that grow without end. I don't yet know how that will look at the top level though. As far as React components are concerned, this talk by Kent Dodds is an inspiration to find a better way: https://www.youtube.com/watch?v=eLNS6GMejjw

easherma commented 5 years ago

I understand that desire to avoid a growing list of optional layout props, but perhaps these elements can be excluded from the base repo as they don't match USWDs spec and cannot easily be excluded as is?

dmethvin-gov commented 5 years ago

I think that is probably the best way to go. Although the names imply they're "text" they really do seem to be used for icons. In that case I wonder if it would be better to add those icons via CSS ::before or ::after. I don't see that afterText is used anywhere at all right now.

easherma commented 5 years ago

They are used in the back and continue buttons. On Wed, Jan 23, 2019 at 2:45 PM Dave Methvin (USDS) < notifications@github.com> wrote:

I think that is probably the best way to go. Although the names imply they're "text" they really do seem to be used for icons. In that case I wonder if it would be better to add those icons via CSS ::before or ::after. I don't see that afterText is used anywhere at all right now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/usds/us-forms-system/issues/335#issuecomment-456959342, or mute the thread https://github.com/notifications/unsubscribe-auth/AKDTT1rCc9JXrOrVTVLIyL1-ZWJGLeyMks5vGMndgaJpZM4aCDXN .

dmethvin-gov commented 5 years ago

I think the best way to do this would be expose the button label as part of i18n efforts and then the user can specify special characters as part of that.