fix: scroll in sidenav (#24521)

* fix: scroll in sidenav

* fix: update snapshot
This commit is contained in:
Adrien L 2025-10-07 11:45:13 +02:00 committed by GitHub
parent 16642119fa
commit 3ae249212a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 796 additions and 766 deletions

View File

@ -7,6 +7,7 @@ import {
Typography, Typography,
IconButton, IconButton,
Badge, Badge,
ScrollArea,
} from '@strapi/design-system'; } from '@strapi/design-system';
import { ChevronDown, Plus } from '@strapi/icons'; import { ChevronDown, Plus } from '@strapi/icons';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
@ -349,8 +350,13 @@ const PageWrapper = styled(Box)`
} }
`; `;
const Content = ({ children }: { children: React.ReactNode }) => {
return <ScrollArea>{children}</ScrollArea>;
};
export const SubNav = { export const SubNav = {
Main, Main,
Content,
Header, Header,
Link, Link,
Sections, Sections,

View File

@ -1,4 +1,4 @@
import { Badge, Divider, ScrollArea } from '@strapi/design-system'; import { Badge, Divider } from '@strapi/design-system';
import { Lightning } from '@strapi/icons'; import { Lightning } from '@strapi/icons';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
@ -78,7 +78,7 @@ const SettingsNav = ({ isFullPage = false }: { isFullPage?: boolean }) => {
<Divider /> <Divider />
</> </>
)} )}
<ScrollArea> <SubNav.Content>
{isFullPage && <SubNav.Header label={label} />} {isFullPage && <SubNav.Header label={label} />}
<SubNav.Sections> <SubNav.Sections>
{sections.map((section) => ( {sections.map((section) => (
@ -124,7 +124,7 @@ const SettingsNav = ({ isFullPage = false }: { isFullPage?: boolean }) => {
</SubNav.Section> </SubNav.Section>
))} ))}
</SubNav.Sections> </SubNav.Sections>
</ScrollArea> </SubNav.Content>
</SubNav.Main> </SubNav.Main>
); );
}; };

View File

@ -1,15 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { useQueryParams, SubNav } from '@strapi/admin/strapi-admin'; import { useQueryParams, SubNav } from '@strapi/admin/strapi-admin';
import { import { Flex, Searchbar, useCollator, useFilter, Divider, Loader } from '@strapi/design-system';
Flex,
Searchbar,
useCollator,
useFilter,
Divider,
ScrollArea,
Loader,
} from '@strapi/design-system';
import { parse, stringify } from 'qs'; import { parse, stringify } from 'qs';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
@ -143,7 +135,7 @@ const LeftMenu = ({ isFullPage = false }: { isFullPage?: boolean }) => {
<Divider /> <Divider />
</> </>
)} )}
<ScrollArea> <SubNav.Content>
{isFullPage && <SubNav.Header label={label} />} {isFullPage && <SubNav.Header label={label} />}
<Flex <Flex
paddingLeft={{ paddingLeft={{
@ -209,7 +201,7 @@ const LeftMenu = ({ isFullPage = false }: { isFullPage?: boolean }) => {
); );
})} })}
</SubNav.Sections> </SubNav.Sections>
</ScrollArea> </SubNav.Content>
</SubNav.Main> </SubNav.Main>
); );
}; };

View File

@ -99,6 +99,7 @@ export const ContentTypeBuilderNav = () => {
<SubNav.Main aria-label={pluginName}> <SubNav.Main aria-label={pluginName}>
<SubNav.Header label={pluginName} /> <SubNav.Header label={pluginName} />
<Divider background="neutral150" /> <Divider background="neutral150" />
<SubNav.Content>
<Flex padding={5} gap={3} direction={'column'} alignItems={'stretch'}> <Flex padding={5} gap={3} direction={'column'} alignItems={'stretch'}>
<tours.contentTypeBuilder.Save> <tours.contentTypeBuilder.Save>
<Flex gap={2}> <Flex gap={2}>
@ -260,6 +261,7 @@ export const ContentTypeBuilderNav = () => {
</Fragment> </Fragment>
))} ))}
</SubNav.Sections> </SubNav.Sections>
</SubNav.Content>
<Dialog.Root <Dialog.Root
open={discardConfirmationModalIsOpen} open={discardConfirmationModalIsOpen}
onOpenChange={setDiscardConfirmationModalIsOpen} onOpenChange={setDiscardConfirmationModalIsOpen}