-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Replace Tabs and skipnav ReachUI with ChakraUI components (#1378)
- Loading branch information
1 parent
e2cf983
commit 96544d2
Showing
8 changed files
with
1,626 additions
and
110 deletions.
There are no files selected for viewing
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
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,12 +1,27 @@ | ||
import { forwardRef } from 'react' | ||
import { TabList as CTabList } from '@chakra-ui/react' | ||
import { TabList as RTabList, TabListProps as RTabListProps } from '@reach/tabs' | ||
import { Flags } from '../../../common/helpers/datasetHelpers' | ||
|
||
export type TabListProps = RTabListProps | ||
|
||
export const TabList = forwardRef<HTMLDivElement, TabListProps>(function TabList({ children, ...rest }, ref) { | ||
return ( | ||
<RTabList ref={ref} {...rest}> | ||
{children} | ||
</RTabList> | ||
) | ||
}) | ||
export type ChakraTabListProps = { | ||
inverted?: boolean | ||
children: React.ReactNode | ||
variant?: string | ||
} | ||
export const TabList = Flags.IS_DEV | ||
? forwardRef<HTMLDivElement, ChakraTabListProps>(function TabList({ children, ...rest }, ref) { | ||
return ( | ||
<CTabList ref={ref} {...rest} style={{ border: 'none' }}> | ||
{children} | ||
</CTabList> | ||
) | ||
}) | ||
: forwardRef<HTMLDivElement, TabListProps>(function TabList({ children, ...rest }, ref) { | ||
return ( | ||
<RTabList ref={ref} {...rest}> | ||
{children} | ||
</RTabList> | ||
) | ||
}) |
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,12 +1,26 @@ | ||
import { forwardRef } from 'react' | ||
import { TabPanel as RTabPanel, TabPanelProps as RTabPanelProps } from '@reach/tabs' | ||
import { TabPanel as CTabPanel } from '@chakra-ui/react' | ||
import { Flags } from '../../../common/helpers/datasetHelpers' | ||
|
||
export type TabPanelProps = RTabPanelProps | ||
|
||
export const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(function TabPanel({ children, ...rest }, ref) { | ||
return ( | ||
<RTabPanel ref={ref} {...rest}> | ||
{children} | ||
</RTabPanel> | ||
) | ||
}) | ||
export type ChakraTabPanelProps = { | ||
inverted?: boolean | ||
children: React.ReactNode | ||
} | ||
export const TabPanel = Flags.IS_DEV | ||
? forwardRef<HTMLDivElement, ChakraTabPanelProps>(function TabPanel({ children, ...rest }, ref) { | ||
return ( | ||
<CTabPanel ref={ref} {...rest}> | ||
{children} | ||
</CTabPanel> | ||
) | ||
}) | ||
: forwardRef<HTMLDivElement, TabPanelProps>(function TabPanel({ children, ...rest }, ref) { | ||
return ( | ||
<RTabPanel ref={ref} {...rest}> | ||
{children} | ||
</RTabPanel> | ||
) | ||
}) |
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,12 +1,26 @@ | ||
import { forwardRef } from 'react' | ||
import { TabPanels as RTabPanels, TabPanelsProps as RTabPanelsProps } from '@reach/tabs' | ||
import { TabPanels as CTabPanels } from '@chakra-ui/react' | ||
import { Flags } from '../../../common/helpers/datasetHelpers' | ||
|
||
export type TabPanelsProps = RTabPanelsProps | ||
|
||
export const TabPanels = forwardRef<HTMLDivElement, TabPanelsProps>(function TabPanels({ children, ...rest }, ref) { | ||
return ( | ||
<RTabPanels ref={ref} {...rest}> | ||
{children} | ||
</RTabPanels> | ||
) | ||
}) | ||
export type ChakraTabPanelsProps = { | ||
inverted?: boolean | ||
children: React.ReactNode | ||
} | ||
export const TabPanels = Flags.IS_DEV | ||
? forwardRef<HTMLDivElement, ChakraTabPanelsProps>(function TabPanels({ children, ...rest }, ref) { | ||
return ( | ||
<CTabPanels ref={ref} {...rest}> | ||
{children} | ||
</CTabPanels> | ||
) | ||
}) | ||
: forwardRef<HTMLDivElement, TabPanelsProps>(function TabPanels({ children, ...rest }, ref) { | ||
return ( | ||
<RTabPanels ref={ref} {...rest}> | ||
{children} | ||
</RTabPanels> | ||
) | ||
}) |
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,13 +1,42 @@ | ||
import { forwardRef } from 'react' | ||
|
||
import { Tabs as CTabs } from '@chakra-ui/react' | ||
import { Tabs as RTabs, TabsProps as RTabsProps } from '@reach/tabs' | ||
import { Flags } from '../../../common/helpers/datasetHelpers' | ||
|
||
export type ChakraTabsProps = { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
align?: 'center' | 'end' | 'start' | ||
colorScheme?: string | ||
defaultIndex?: number | ||
direction?: 'ltr' | 'rtl' | ||
id?: string | ||
index?: number | ||
isFitted?: boolean | ||
isLazy?: boolean | ||
isManual?: boolean | ||
lazyBehaviour?: any | ||
onChange?: (index: number) => void | ||
orientation?: 'horizontal' | 'vertical' | ||
size?: 'sm' | 'md' | 'lg' | ||
variant?: 'line' | 'enclosed' | 'enclosed-colored' | 'soft-rounded' | 'solid-rounded' | 'unstyled' | ||
inverted?: boolean | ||
children: React.ReactNode | ||
} | ||
|
||
export type TabsProps = RTabsProps | ||
|
||
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs({ children, ...rest }, ref) { | ||
return ( | ||
<RTabs ref={ref} {...rest}> | ||
{children} | ||
</RTabs> | ||
) | ||
}) | ||
export const Tabs = Flags.IS_DEV | ||
? forwardRef<HTMLDivElement, ChakraTabsProps>(function Tabs({ children, ...rest }, ref) { | ||
return ( | ||
<CTabs ref={ref} {...rest}> | ||
{children} | ||
</CTabs> | ||
) | ||
}) | ||
: forwardRef<HTMLDivElement, TabsProps>(function Tabs({ children, ...rest }, ref) { | ||
return ( | ||
<RTabs ref={ref} {...rest}> | ||
{children} | ||
</RTabs> | ||
) | ||
}) |
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
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
Oops, something went wrong.
1 comment
on commit 96544d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can remove this and import directly from the lib like it was done for the reach UI before