Skip to content

Commit

Permalink
chore: JS tab interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
zstix committed Jun 2, 2021
1 parent 5abfe63 commit 1d2bf1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/Tabs/Pages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';

const Pages = ({ children }) =>
React.Children.map(children, (child, index) =>
React.cloneElement(child, { index })
);

Pages.propTypes = {
children: PropTypes.node.isRequired,
};

export default Pages;
6 changes: 6 additions & 0 deletions src/components/Tabs/useTabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { useContext } from 'react';
import TabsContext from './Context';

const useTabs = () => useContext(TabsContext);

export default useTabs;

0 comments on commit 1d2bf1b

Please sign in to comment.