github
210 of 278 branches covered (0.0%)
Branch coverage included in aggregate %.
8 of 15 new or added lines in 2 files covered. (53.33%)
7514 of 8832 relevant lines covered (85.08%)
3.86 hits per line
1 |
import { |
2✔ |
2 |
Children, |
2✔ |
3 |
ComponentProps, |
2✔ |
4 |
ReactNode, |
2✔ |
5 |
cloneElement, |
2✔ |
6 |
isValidElement, |
2✔ |
7 |
} from 'react'; |
2✔ |
|
import { Tab } from '@deriv/quill-design'; |
2✔ |
|
|
2✔ |
|
export interface TabProps {
|
2✔ |
|
tabs: ComponentProps<typeof Tab.Trigger>[];
|
2✔ |
|
className?: string;
|
2✔ |
13 |
children: ReactNode;
|
2✔ |
14 |
} |
2✔ |
|
|
2✔ |
16 |
export const TabBase = ({ tabs, children, className }: TabProps) => { |
2✔ |
17 |
return (
|
× |
18 |
<Tab.Container className={className}> |
× |
19 |
<Tab.List> |
× |
20 |
{tabs.map(({ children, ...rest }, i) => ( |
× |
21 |
<Tab.Trigger {...rest} key={i}> |
× |
22 |
{children} |
× |
23 |
</Tab.Trigger> |
× |
NEW
|
))} |
× |
NEW
|
</Tab.List> |
× |
NEW
|
<Tab.Content> |
× |
NEW
|
{Children.map(children, (child) => { |
× |
NEW
|
if (!isValidElement(child)) return null; |
× |
NEW
|
return (
|
× |
NEW
|
<Tab.Panel> |
× |
31 |
{cloneElement(child, { |
× |
32 |
...child.props, |
× |
33 |
})} |
× |
34 |
</Tab.Panel> |
× |
35 |
); |
× |
36 |
})} |
× |
37 |
</Tab.Content> |
× |
38 |
</Tab.Container> |
× |
39 |
); |
× |
40 |
}; |
× |
41 |
|
2✔ |
42 |
export default TabBase; |
2✔ |