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

feat: add accessible react-bootstrap components #550

Merged
merged 22 commits into from
Jul 17, 2020

Conversation

abutterworth
Copy link
Contributor

@abutterworth abutterworth commented Jul 15, 2020

Adds the following react-bootstrap components with jump off documentation pages:

  • Alert
  • Badge
  • Button Group
  • Card
  • Carousel
  • Figure
  • Forms
  • Input Group
  • Image
  • Navs
  • Navbar
  • Overlays
  • Popover
  • ProgressBar
  • Spinner
  • Tooltip
  • Toast

Sample Doc:

Screen Shot 2020-07-16 at 5 24 01 PM

@abutterworth abutterworth changed the title feat: add react-bootstrap alert [WIP] feat: add react-bootstrap alert Jul 15, 2020
@coveralls
Copy link

coveralls commented Jul 15, 2020

Coverage Status

Coverage remained the same at 88.012% when pulling e957307 on abutterworth/add-react-bootstrap into c9c2632 on master.

@abutterworth abutterworth changed the title [WIP] feat: add react-bootstrap alert [WIP] feat: add accessible react-bootstrap components Jul 15, 2020
Skip conflicting components that will be shimmed. Add TODOs for components with a11y defects to be addressed in the future
@abutterworth abutterworth force-pushed the abutterworth/add-react-bootstrap branch from 8b86f77 to 7b88a66 Compare July 16, 2020 13:16
export { default as BreadcrumbItem } from 'react-bootstrap/BreadcrumbItem';
*/
// TODO: create shim – export { default as Button } from 'react-bootstrap/Button';
export { default as ButtonGroup } from 'react-bootstrap/ButtonGroup';
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these Button* components compatible with our Button above, that we have yet to shim?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are! I tested them in the doc page just added.

@davidjoy
Copy link
Contributor

Two thoughts -

One, I'm curious how a lot of these interact with our existing Paragon components when they're used in sensible ways that folks might expect (our input classes inside their Form, for instance)

Two, documenting all this will be interesting. In the past we chose to duplicate/wrap all the Bootstrap documentation... are we going to reproduce react-bootstrap's? Or just reference it from the paragon documentation? Seems like we're going to need to have a big shift in the doc around which components are deprecated... are we doing a major version change and just removing stuff? And in reference to the first thought above, documenting any subtlety to those interactions will be fun.

@davidjoy
Copy link
Contributor

And also, just a reminder to check on tree-shaking to make sure they've packaged react-bootstrap in such a way that it can still be slimmed down when used through Paragon.

@davidjoy
Copy link
Contributor

Also - after having investigated react-bootstrap quite a bit now, how many cases do we see where we want to 'wrap' things? Have we seen any specific benefits to exposing them through paragon?

Just thinking about whether or not it'd be a reasonable choice to make react-bootstrap a recommended library and call it a day. 🤔 (not sure I think this is a good idea)

@abutterworth
Copy link
Contributor Author

Great points David.

  • Interaction between components: So far it seems like they're pretty interoperable. I know ValidationFormGroup will not do its job with the react-bootstrap components. I intend to mark the components that I know won't work together. As far as I'm aware right now, that's the only one. I may find more as I continue building the docs.
  • Documentation: I'm adding one or two examples of usage and then linking to the react-bootstrap docs themselves. I think this is the best blend between convenience and not doing extra work
  • Tree-shaking: I will double check in a project, but judging by the structure I'm confident it will tree-shake fine.

Why pull it in? Incorporating react-bootstrap inside paragon will help us:

  1. maintain flexibility in the future by making Paragon the single source of truth. We can replace react-bootstrap components with our own in the future if we choose.
  2. By using Paragon to pull in these components we can leverage them internally in Paragon without worrying about peer deps or versions of react-bootstrap.

In general I expect the future of Paragon to aim to create more "molecule-level" components that are composed of these react-bootstrap elements and in the further future we can swap the underlying technology with CSS-in-JS iteratively.

@abutterworth abutterworth changed the title [WIP] feat: add accessible react-bootstrap components feat: add accessible react-bootstrap components Jul 16, 2020
@abutterworth abutterworth requested review from davidjoy and a team July 16, 2020 21:30
Copy link

@stvstnfrd stvstnfrd left a comment

Choose a reason for hiding this comment

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

Just a question and a typo (?) in my drive-by review.

Just want to say, I'm really glad to see paragon coming together; a unified style/component guide/manual is huuuge and long-awaited!

src/index.js Outdated Show resolved Hide resolved
@davidjoy
Copy link
Contributor

Thanks for indulging the second-guessing questions, @abutterworth. Explanations totally make sense/I'm behind this!

@@ -1,10 +1,10 @@
export { default as asInput } from './asInput';
export { default as Breadcrumb } from './Breadcrumb';
export { default as Button } from './Button';
export { default as Button } from './Button'; // TODO: shim from react-bootstrap
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these TODOs something that should be completed in this PR? Or for later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For follow up PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the shims is more risky in terms of inadvertently making breaking changes so I'll keep them separate.

@@ -1,13 +1,11 @@
---
title: 'StatusAlert'
type: 'component'
status: 'Needs Work'
status: 'Deprecate Soon'
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel like we have so many variations on this alert floating around in the MFEs. :)

export { default as Overlay } from 'react-bootstrap/Overlay';
export { default as OverlayTrigger } from 'react-bootstrap/OverlayTrigger';
export { default as PageItem } from 'react-bootstrap/PageItem';
// TODO: create shim – export { default as Pagination } from 'react-bootstrap/Pagination';
Copy link
Member

Choose a reason for hiding this comment

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

We won't be able to simply shim react-bootstrap's Pagination component here, since the component just provides the visual UI, without the underlying logic to actually make it function, where it sends callbacks and accepts props such as current page, onPageSelect, etc.

By shimming it directly, the consumers on the Pagination component would need to implement that logic themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call out, with Pagination in particular. What do you think about a future breaking change that pulls in react-bootstrap's pagination and moving the purpose of the current Pagination to a PaginationGroup or something?

<Image src={generateCustomPlaceholderURL(180, 180)} roundedCircle />
</Col>
<Col xs={6} md={4}>
<Image src={generateCustomPlaceholderURL(180, 180)} thumbnail />
Copy link
Member

Choose a reason for hiding this comment

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

nit: might be good to include the fluid prop on one of these examples, as I imagine that will be a commonly used prop for Image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to figure out what fluid actually does and couldn't see any change there. What's it for?

@abutterworth abutterworth merged commit b067fb4 into master Jul 17, 2020
@abutterworth abutterworth deleted the abutterworth/add-react-bootstrap branch July 17, 2020 15:44
@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 9.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

6 participants