Commit 6290429c authored by tom's avatar tom

fix adaptive tabs

parent 50676eb5
...@@ -117,7 +117,7 @@ const AdaptiveTabsList = (props: Props) => { ...@@ -117,7 +117,7 @@ const AdaptiveTabsList = (props: Props) => {
ref={ ref } ref={ ref }
tabs={ tabs } tabs={ tabs }
tabsCut={ tabsCut } tabsCut={ tabsCut }
isActive={ activeTabIndex > 0 && activeTabIndex >= tabsCut } isActive={ activeTabIndex > 0 && tabsCut > 0 && activeTabIndex >= tabsCut }
{ ...(tabsCut >= tabs.length ? HIDDEN_ITEM_STYLES : {}) } { ...(tabsCut >= tabs.length ? HIDDEN_ITEM_STYLES : {}) }
/> />
); );
...@@ -130,7 +130,7 @@ const AdaptiveTabsList = (props: Props) => { ...@@ -130,7 +130,7 @@ const AdaptiveTabsList = (props: Props) => {
ref={ ref } ref={ ref }
scrollSnapAlign="start" scrollSnapAlign="start"
flexShrink={ 0 } flexShrink={ 0 }
{ ...(!tabsCut || index < tabsCut ? {} : HIDDEN_ITEM_STYLES as never) } { ...(index < tabsCut ? {} : HIDDEN_ITEM_STYLES as never) }
> >
<Skeleton loading={ isLoading }> <Skeleton loading={ isLoading }>
{ typeof tab.title === 'function' ? tab.title() : tab.title } { typeof tab.title === 'function' ? tab.title() : tab.title }
......
...@@ -61,12 +61,12 @@ const TabsShowcase = () => { ...@@ -61,12 +61,12 @@ const TabsShowcase = () => {
<SectionSubHeader>Adaptive tabs</SectionSubHeader> <SectionSubHeader>Adaptive tabs</SectionSubHeader>
<SamplesStack> <SamplesStack>
<Sample> <Sample gridColumn="1 / 3" w="100%" maxW={{ base: '100vw', lg: '700px' }}>
<AdaptiveTabs <AdaptiveTabs
w="100%"
tabs={ tabs } tabs={ tabs }
defaultValue={ tabs[0].id } defaultValue={ tabs[0].id }
outline="1px dashed lightpink" outline="1px dashed lightpink"
listProps={{ maxW: { base: '100vw', lg: '40vw' } }}
leftSlot={ <Box display={{ base: 'none', lg: 'block' }}>Left element</Box> } leftSlot={ <Box display={{ base: 'none', lg: 'block' }}>Left element</Box> }
leftSlotProps={{ pr: { base: 0, lg: 4 }, color: 'text.secondary' }} leftSlotProps={{ pr: { base: 0, lg: 4 }, color: 'text.secondary' }}
rightSlot={ <Box display={{ base: 'none', lg: 'block' }}>Right element</Box> } rightSlot={ <Box display={{ base: 'none', lg: 'block' }}>Right element</Box> }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment