Skip to content

New component: Toolbar #412

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

Merged
merged 13 commits into from
Feb 10, 2021
Merged

New component: Toolbar #412

merged 13 commits into from
Feb 10, 2021

Conversation

Nuhvi
Copy link
Contributor

@Nuhvi Nuhvi commented Jan 30, 2021

Disclaimer: I did not communicate my intention to work on this so I will understand if you decided not to spend any time reviewing it, but I will appreciate it if you did!

I saw that Toolbar was not assigned to anyone in the Roadmap and I liked the documentation and example in WAI-ARIA

The reason I opened a draft PR is to make sure I am not going in the wrong direction, and ask what further requirements do you expect from this component before it is ready?

Thanks for your time.

localhost_9009__path=_story_components-accessibleicon--styled

Note: the Menu will not behave as shown in the screenshot above because #411

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code.
  • Add or edit tests to reflect the change (run yarn test).
  • Add or edit Storybook examples to reflect the change (run yarn dev).
  • Add documentation to support any new features.

This pull request:

  • Fixes a bug in an existing package
  • Adds additional features/functionality to an existing package
  • Updates documentation or example code
  • Other

Nuhvi added 4 commits January 25, 2021 06:07
* Add ToolbarGroup
* Add ToolbarLabel
* Add ToolbarSeparator
* Add ToolbarItem
* Use Orientation for styling Group and Separator
* Create a story with ToggleButton, Group, DropDownMenu, and anchor link
@benoitgrelard
Copy link
Contributor

This is awesome @nazeh! Thanks so much for this ♥️
We'll definitely take time to review it!

@Nuhvi
Copy link
Contributor Author

Nuhvi commented Feb 1, 2021

Used composeEventHandlers to allow ToolbarItems to actually do stuff 🤦‍♂️

Copy link
Contributor

@jjenzz jjenzz left a comment

Choose a reason for hiding this comment

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

Please don't be discouraged by the amount of comments I've left here 😅 This PR is really great!! Thank you!!

Most of the stuff below is just little niggles but I love how well you've followed the overall architecture of our components 😍 It was a joy to review.

Copy link
Contributor

@benoitgrelard benoitgrelard left a comment

Choose a reason for hiding this comment

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

@jjenzz's already outlined most of the feedback, I've added a couple more tidbits for consistency.

I just wanted to also say amazing work on that one following the current project structure, etc ♥️

Nuhvi added 2 commits February 4, 2021 18:20
* Use patch instead of prerelease
* Update package.json scripts and version
* Used *Class naming for css()
* Remove ToolbarLabel
* Add uniqueInputID
* Remove pointerEvents: 'none' to better test onClick()
* Use 'div' instead of 'button' to test 'disabled'
* Update ToolbarItem onClick() to preventDefault() and skip itemProps.onClick
  for disabled itmes
* Refactor onKeyDown() for the link in Toolbar.stories.tsx
* Add onClick() instead of onKeyDown() for 'button'
* Add onClick() for disabled ToolbarItem to make sure it does not trigger
* Use Separator from react-separator in ToolbarSeparator
* Use RavingFocuseGroupProps properly
* Add defaults for 'dir' and 'loop' to match type defenition
* Remove children if it is already spreaded
* Inline React.uesMemo()
* Use correct order of spreading props
* Remove all use of any
@Nuhvi
Copy link
Contributor Author

Nuhvi commented Feb 4, 2021

@jjenzz @benoitgrelard Thank you so much for the review and encouragement.
I made most of the requested changes, I think, except for two unresolved conversations about aria-control and the onClick in ToolbarItem, looking forward to your comments there.

I should be able to work on those in the morning, have a good afternoon!

@jjenzz
Copy link
Contributor

jjenzz commented Feb 8, 2021

This is looking great. Thanks for the updates @nazeh. I've left a few comments in response to bits and pieces above and a small change here #412 (comment)

Would be good to get @benoitgrelard's input on some of it. Super close now I think 👍

@jjenzz jjenzz changed the title Draft: New component: Toolbar New component: Toolbar Feb 8, 2021
@benoitgrelard
Copy link
Contributor

benoitgrelard commented Feb 9, 2021

This is really close! ♥️
I've added my 2 cents on the last remaining (unresolved) bits (I've unresolved an extra one).

@Nuhvi
Copy link
Contributor Author

Nuhvi commented Feb 9, 2021

Thanks @benoitgrelard,and @jjenzz for the feedback, I guess there are two more issues:

1- should I worry about adding Chromatic? and if so, how should I do that?

2- I notice a significant offset between the DropdownMenu and its trigger, do you have any idea what could be going wrong here before I start chasing my tail?
localhost_9009__path=_story_components-toolbar - styled (2)
localhost_9009__path=_story_components-toolbar - styled (3)

@jjenzz
Copy link
Contributor

jjenzz commented Feb 10, 2021

@nazeh , noooo, thank you for all your effort and patience with this 🙂

1- should I worry about adding Chromatic? and if so, how should I do that?

Since you won't have access to our Github Secrets, I will change the base branch here to toolbar-test and then once merged, I will create a new PR from there into main. That should make Chromatic run a baseline build of the Toolbar for us 🤞

2- I notice a significant offset between the DropdownMenu and its trigger, do you have any idea what could be going wrong here before I start chasing my tail?

Interesting, I'll take a look into this now quickly for you!

@jjenzz jjenzz changed the base branch from main to toolbar-test February 10, 2021 12:05
@benoitgrelard
Copy link
Contributor

Regarding that gap in the dropdown menu, we're aware of this, it will happen in very specific circumstances when margins collapse on body. There are easy workarounds and we will looks at potentially replacing some dependency with our own to avoid it alltogether.

Thanks so much for your work on this @nazeh!

@jjenzz jjenzz merged commit df0cf48 into radix-ui:toolbar-test Feb 10, 2021
benoitgrelard pushed a commit that referenced this pull request Feb 15, 2021
jjenzz pushed a commit that referenced this pull request Feb 16, 2021
benoitgrelard added a commit that referenced this pull request Feb 16, 2021
* New component: Toolbar (#412)

* Add `ToolbarLink`, `ToolbarRadioGroup` & rename `ToolbarItem`

* PR feedback

* Forward `as` prop in `ToolbarRadioItem`

* Replace inline component in `ToolbarRadioItem` with `Slot`

* Update yarn.lock

* Add chromatic stories

* Add prominent toggle button toggled styles

Co-authored-by: Ar Nazeh <[email protected]>
Co-authored-by: Benoît Grélard <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants