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

View File

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

View File

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