Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove buttonType prop from Button component #358

Closed
adamstankiewicz opened this issue Nov 9, 2018 · 2 comments
Closed

Remove buttonType prop from Button component #358

adamstankiewicz opened this issue Nov 9, 2018 · 2 comments

Comments

@adamstankiewicz
Copy link
Member

The Button component currently has a buttonType prop which allows the consumer to pass in the class name of the Bootstrap button to use (e.g., primary, link, etc.). This value is prefixed with btn- and added to the list of class names.

However, we also have a type prop which represents the actual type of the button (i.e., submit, reset, button). Having both of these props is confusing as buttonType does not actually represent a type of button as it's used as a class name.

Instead, we should deprecate the buttonType prop and have consumers of the Button component pass in the Bootstrap class name (e.g., .btn-primary) in the className prop.

Note: This would be a breaking change.

cc: @georgebabey

@abutterworth
Copy link
Contributor

abutterworth commented Apr 1, 2019

To move forward with removing buttonType we can add a new kind of backward compatible deprecation to withDeprecatedProps. Maybe a new type like REMOVE or REPLACED or something.
https://github.com/edx/paragon/blob/master/src/withDeprecatedProps.jsx

So usage with exporting Button could be something like:

export withDeprecatedProps(Button, {
  buttonType: {
    deprType: DEPR_TYPES.CONSOLIDATED,
    consolidate: (value, transformedProps) => {
      return {
        ...transformedProps,
        className: transformedProps.className + " btn-" + value
    };
  },
});

Do you want to take this on or should I?

@abutterworth
Copy link
Contributor

Fixed a while back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants