mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
refactor: Composable new in unleash (#8505)
This commit is contained in:
parent
d3294d58c2
commit
cbfdb8ca6e
@ -18,6 +18,7 @@ import { NavigationSidebar } from './NavigationSidebar/NavigationSidebar';
|
||||
import { MainLayoutEventTimeline } from './MainLayoutEventTimeline';
|
||||
import { EventTimelineProvider } from 'component/events/EventTimeline/EventTimelineProvider';
|
||||
import { AIChat } from 'component/ai/AIChat';
|
||||
import { NewInUnleash } from './NavigationSidebar/NewInUnleash/NewInUnleash';
|
||||
|
||||
interface IMainLayoutProps {
|
||||
children: ReactNode;
|
||||
@ -124,7 +125,11 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
|
||||
>
|
||||
<ConditionallyRender
|
||||
condition={!isSmallScreen}
|
||||
show={<NavigationSidebar />}
|
||||
show={
|
||||
<NavigationSidebar
|
||||
NewInUnleash={NewInUnleash}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<Box
|
||||
|
@ -15,16 +15,17 @@ import {
|
||||
import { useInitialPathname } from './useInitialPathname';
|
||||
import { useLastViewedProject } from 'hooks/useLastViewedProject';
|
||||
import { useLastViewedFlags } from 'hooks/useLastViewedFlags';
|
||||
import { NewInUnleash } from './NewInUnleash/NewInUnleash';
|
||||
import type { NewInUnleash } from './NewInUnleash/NewInUnleash';
|
||||
|
||||
export const MobileNavigationSidebar: FC<{ onClick: () => void }> = ({
|
||||
onClick,
|
||||
}) => {
|
||||
export const MobileNavigationSidebar: FC<{
|
||||
onClick: () => void;
|
||||
NewInUnleash?: typeof NewInUnleash;
|
||||
}> = ({ onClick, NewInUnleash }) => {
|
||||
const { routes } = useRoutes();
|
||||
|
||||
return (
|
||||
<>
|
||||
<NewInUnleash onItemClick={onClick} />
|
||||
{NewInUnleash ? <NewInUnleash /> : null}
|
||||
<PrimaryNavigationList mode='full' onClick={onClick} />
|
||||
<SecondaryNavigationList
|
||||
routes={routes.mainNavRoutes}
|
||||
@ -66,7 +67,9 @@ const StickyContainer = styled(Box)(({ theme }) => ({
|
||||
borderTop: `1px solid ${theme.palette.divider}`,
|
||||
}));
|
||||
|
||||
export const NavigationSidebar = () => {
|
||||
export const NavigationSidebar: FC<{ NewInUnleash?: typeof NewInUnleash }> = ({
|
||||
NewInUnleash,
|
||||
}) => {
|
||||
const { routes } = useRoutes();
|
||||
|
||||
const [mode, setMode] = useNavigationMode();
|
||||
@ -154,10 +157,12 @@ export const NavigationSidebar = () => {
|
||||
<Box sx={{ flex: 1 }} />
|
||||
|
||||
<StickyContainer>
|
||||
<NewInUnleash
|
||||
mode={mode}
|
||||
onMiniModeClick={() => setMode('full')}
|
||||
/>
|
||||
{NewInUnleash ? (
|
||||
<NewInUnleash
|
||||
mode={mode}
|
||||
onMiniModeClick={() => setMode('full')}
|
||||
/>
|
||||
) : null}
|
||||
<ShowHide
|
||||
mode={mode}
|
||||
onChange={() => {
|
||||
|
@ -89,13 +89,11 @@ type NewItem = {
|
||||
|
||||
interface INewInUnleashProps {
|
||||
mode?: NavigationMode;
|
||||
onItemClick?: () => void;
|
||||
onMiniModeClick?: () => void;
|
||||
}
|
||||
|
||||
export const NewInUnleash = ({
|
||||
mode = 'full',
|
||||
onItemClick,
|
||||
onMiniModeClick,
|
||||
}: INewInUnleashProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
@ -8,6 +8,7 @@ import styles from './DrawerMenu.module.scss'; // FIXME: useStyle - theme
|
||||
import theme from 'themes/theme';
|
||||
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
|
||||
import { MobileNavigationSidebar } from 'component/layout/MainLayout/NavigationSidebar/NavigationSidebar';
|
||||
import { NewInUnleash } from 'component/layout/MainLayout/NavigationSidebar/NewInUnleash/NewInUnleash';
|
||||
|
||||
const StyledDrawerHeader = styled('div')(({ theme }) => ({
|
||||
display: 'flex',
|
||||
@ -71,7 +72,10 @@ export const DrawerMenu: VFC<IDrawerMenuProps> = ({
|
||||
</Link>
|
||||
</StyledDrawerHeader>
|
||||
<Divider />
|
||||
<MobileNavigationSidebar onClick={toggleDrawer} />
|
||||
<MobileNavigationSidebar
|
||||
onClick={toggleDrawer}
|
||||
NewInUnleash={NewInUnleash}
|
||||
/>
|
||||
</nav>
|
||||
</Drawer>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user