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(react): update Tabs API and delete next/Tab #10225

Merged
merged 22 commits into from
Dec 7, 2021
Merged

feat(react): update Tabs API and delete next/Tab #10225

merged 22 commits into from
Dec 7, 2021

Conversation

abbeyhrt
Copy link
Contributor

@abbeyhrt abbeyhrt commented Dec 3, 2021

Closes #10086
Closes #9988
REF #8487

Updates the API for Tabs from

  <Tabs>
    <Tab id="tab-1" label="Tab label 1">
      <p>Content for first tab</p>
    </Tab>
    <Tab id="tab-2" label="Tab label 2">
      <p>Content for second tab</p>
    </Tab>
    <Tab id="tab-3" clabel="Tab label 3">
      <p>Content for third tab</p>
    </Tab>
    <Tab label={<div>Custom Label</div>}>
      <p>Content for fourth tab</p>
    </Tab>
  </Tabs>

to

  <Tabs>
    <TabList aria-label="List of tabs">
      <Tab>Tab Label 1</Tab>
      <Tab disabled>Tab Label 2</Tab>
      <Tab>Tab Label 3</Tab>
      <Tab>Tab Label 4 with a very long long label</Tab>
    </TabList>
    <TabPanels>
      <TabPanel><p>Content for first tab</p></TabPanel>
      <TabPanel><p>Content for second tab</p></TabPanel>
      <TabPanel><p>Content for third tab</p></TabPanel>
      <TabPanel><p>Content for fourth tab</p></TabPanel>
    </TabPanels>
  </Tabs>

This PR however does not implement horizontal scrolling. It felt like it was getting way too big and I thought that could be added after this is merged in.

Changelog

New

  • Tabs API
  • unstable_TabPanel
  • unstable_TabPanels
  • unstable_TabList

Changed

  • Tabs, the component itself is now a context provider and does not contain the bulk of the logic, that is now in TabList
  • styles to accommodate the new composition

Removed

  • next/Tab Tab will now be kept in context in Tabs.js instead of in its own directory

Testing / Reviewing

Pull down the PR and check to see how the component looks in the V11 storybook. Check to make sure that whatever functionality was available in Tabs or Tab (outside of scrolling) is still available in the new structure. There are some prop name changes but the same functionality should still exist.

@abbeyhrt abbeyhrt requested a review from a team as a code owner December 3, 2021 23:26
@abbeyhrt abbeyhrt changed the title Feat/update tabs api feat(react): update Tabs API and delete next/Tab Dec 3, 2021
@abbeyhrt abbeyhrt changed the title feat(react): update Tabs API and delete next/Tab feat(react): update Tabs API and delete next/Tab Dec 3, 2021
@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: 28fc7e6

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/61afd177bcd7ac00098c635c

😎 Browse the preview: https://deploy-preview-10225--carbon-react-next.netlify.app

@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for carbon-components-react ready!

🔨 Explore the source changes: 28fc7e6

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/61afd177ecf5060007f0dc32

😎 Browse the preview: https://deploy-preview-10225--carbon-components-react.netlify.app

@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 28fc7e6

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/61afd177211dfd0008c872cc

😎 Browse the preview: https://deploy-preview-10225--carbon-elements.netlify.app

@joshblack
Copy link
Contributor

I think you just need to update snapshots for our package entry points and you'll be good to go 👍

@abbeyhrt abbeyhrt requested a review from a team as a code owner December 6, 2021 23:20
@tay1orjones
Copy link
Member

tay1orjones commented Dec 7, 2021

This PR however does not implement horizontal scrolling. It felt like it was getting way too big and I thought that could be added after this is merged in.

@abbeyhrt Totally fair 👍 I made an issue for it, #10249

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

This is awesome! One minor bit, but otherwise good to go 👍

packages/react/src/index.js Outdated Show resolved Hide resolved
@kodiakhq kodiakhq bot merged commit ab061bd into carbon-design-system:main Dec 7, 2021
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.

[Tabs]: Refactor to provide TabList, TabPanels, TabPanel [Tabs]: Update Tabs to have icon-only variant
3 participants