-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddc1d5b
commit fad9db1
Showing
15 changed files
with
226 additions
and
816 deletions.
There are no files selected for viewing
65 changes: 0 additions & 65 deletions
65
packages/design-system/src/components/Tabs/Primitive/TabAsLink.tsx
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
packages/design-system/src/components/Tabs/Primitive/TabElement.tsx
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
packages/design-system/src/components/Tabs/Primitive/TabList.tsx
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
packages/design-system/src/components/Tabs/Primitive/TabNavigation.tsx
This file was deleted.
Oops, something went wrong.
26 changes: 18 additions & 8 deletions
26
packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
111
packages/design-system/src/components/Tabs/Primitive/TabState.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.