Skip to content

Commit

Permalink
feat: reimplement tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrancois committed Oct 16, 2023
1 parent ddc1d5b commit fad9db1
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 816 deletions.
65 changes: 0 additions & 65 deletions packages/design-system/src/components/Tabs/Primitive/TabAsLink.tsx

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions packages/design-system/src/components/Tabs/Primitive/TabList.tsx

This file was deleted.

107 changes: 0 additions & 107 deletions packages/design-system/src/components/Tabs/Primitive/TabNavigation.tsx

This file was deleted.

26 changes: 18 additions & 8 deletions packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import { forwardRef, ReactNode, Ref } from 'react';
import { useContext } from 'react';
import { TabsInternalContext } from './TabsProvider';

export type TabPanelProps = {
children: ReactNode;
type TabPanelPropTypes = {
id: string;
children: React.ReactNode | React.ReactNode[];
renderIf?: boolean;
};

const TabPanel = forwardRef(({ children, id }: TabPanelProps, ref: Ref<HTMLDivElement>) => {
export function TabPanel({ children, id, renderIf }: TabPanelPropTypes): JSX.Element {
const context = useContext(TabsInternalContext);
const style = {
display: '',
};
if (id !== context?.value) {
if (renderIf) {
return <></>;
}
style.display = 'none';
}
return (
<div ref={ref} id={id} role="tabpanel" tabIndex={0}>
<div id={id} role="tabpanel" style={style} tabIndex={0}>
{children}
</div>
);
});
}

TabPanel.displayName = 'TabPanel';

export default TabPanel;
111 changes: 0 additions & 111 deletions packages/design-system/src/components/Tabs/Primitive/TabState.ts

This file was deleted.

Loading

0 comments on commit fad9db1

Please sign in to comment.