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

[TASK-915] Simplify button component (even more) #5046

Merged
merged 16 commits into from
Sep 3, 2024

Conversation

magicznyleszek
Copy link
Member

@magicznyleszek magicznyleszek commented Aug 2, 2024

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

Minimizes the amount of button types we use in the UI. There are still some legacy buttons being used (that don't look properly), but the vast majority of buttons will now fall into 5 distinct types. This is an improvement from current 9 types, and from previous 15 types we've had for the last few years.

Improved the accessibility of Button: pending state is no longer focusable and keyboard-clickable, disabled button is no longer TAB focusable

Notes

Things changed here:

  • Changed Button component to not use type + color mix, but rather unified and simplified type (we have 5 types: primary, secondary, danger, secondary danger, and text)
  • Updated all instances of <Button> to use the new type
  • Updated Button stories to have a view with all the buttons types, sizes and states being displayed at the same time

Related issues

Includes work from #5033

After merging this kobotoolbox/docs#372 can be done

Copy link

# Conflicts:
#	jsapp/js/projects/projectsTable/projectQuickActions.tsx
#	jsapp/scss/libs/react-tagsinput.scss
@magicznyleszek magicznyleszek marked this pull request as ready for review August 3, 2024 08:45
@duvld duvld self-assigned this Aug 16, 2024
@magicznyleszek magicznyleszek mentioned this pull request Aug 26, 2024
7 tasks
@magicznyleszek magicznyleszek requested a review from duvld August 26, 2024 09:53
| 'blue'
| 'red'
| 'dark-blue';
export type ButtonType = 'primary' | 'secondary' | 'danger' | 'secondary-danger' | 'text';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nitpick. Is there a way to add a jsdoc to this type such that it shows up when auto-completing? At first glance these names are a bit vague and requires the user to read this component whereas before it was a bit more descriptive.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
(Just checking it is the same on vscode also)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a JSDoc comment for the line where type is defined, but I will move it to the line where button prop is - it should do the trick 🆗

Copy link
Member

@duvld duvld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else looks good to me :)

| 'blue'
| 'red'
| 'dark-blue';
export type ButtonType = 'primary' | 'secondary' | 'danger' | 'secondary-danger' | 'text';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
(Just checking it is the same on vscode also)

@magicznyleszek magicznyleszek merged commit 98cf909 into beta Sep 3, 2024
7 checks passed
@magicznyleszek magicznyleszek deleted the task915-simplify-button-component branch September 3, 2024 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants