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 baseId option to useRoverState and derivative hooks #494

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

diegohaz
Copy link
Member

This PR is a follow-up to #492.

  • Compose useIdState into useRoverState and, therefore, its derivative hooks, such as useTabState, useToolbarState and useRadioState.
  • Compose Id into Rover and its derivative components.
  • Compose IdGroup into TabList and Toolbar

Now it's possible to pass a baseId option to useRoverState, useTabState, useToolbarState and useRadioState so their rover items will have a predictable id attribute.

Since they compose now from IdGroup, it's also possible to pass an id prop to TabList and Toolbar to achieve the same result:

// we can now pass `baseId` to the state hook or `id` to the `IdGroup` (`Toolbar`) component
const toolbar = useToolbarState({ baseId: "toolbar" });
<Toolbar {...toolbar} id="toolbar">
  <ToolbarItem {...toolbar} />
  <ToolbarItem {...toolbar} />
  <ToolbarItem {...toolbar} />
  <ToolbarItem {...toolbar} />
</Toolbar>

Does this PR introduce a breaking change?

No

@codecov
Copy link

codecov bot commented Nov 14, 2019

Codecov Report

Merging #494 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #494      +/-   ##
==========================================
- Coverage   95.42%   95.41%   -0.01%     
==========================================
  Files         100      100              
  Lines        1487     1484       -3     
  Branches      472      471       -1     
==========================================
- Hits         1419     1416       -3     
  Misses         68       68
Impacted Files Coverage Δ
packages/reakit/src/Tab/TabList.tsx 100% <ø> (ø) ⬆️
packages/reakit/src/Provider.tsx 66.66% <ø> (ø) ⬆️
packages/reakit/src/Tab/Tab.ts 100% <ø> (ø) ⬆️
packages/reakit/src/Toolbar/Toolbar.tsx 100% <ø> (ø) ⬆️
packages/reakit/src/Id/IdState.ts 100% <ø> (ø) ⬆️
packages/reakit/src/Tab/TabState.ts 90.9% <ø> (-1.4%) ⬇️
packages/reakit/src/Tab/TabPanel.ts 100% <ø> (ø) ⬆️
packages/reakit/src/Rover/RoverState.ts 96.2% <100%> (+0.14%) ⬆️
packages/reakit/src/Rover/Rover.ts 94.11% <100%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50fd7df...0c2094a. Read the comment docs.

@ariakit-bot
Copy link

Deploy preview for reakit ready!

Built with commit 0c2094a

https://deploy-preview-494--reakit.netlify.com

@diegohaz diegohaz merged commit 42e9dd0 into master Nov 14, 2019
@diegohaz diegohaz deleted the feat/base-id branch November 14, 2019 17:29
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.

None yet

2 participants