Fixed command menu and main container layout (#16665)
This PR fixes https://github.com/twentyhq/twenty/issues/16645 It solves two problems : - Command menu for mobile was outside of its proper place, it should have been portaled instead of lifted that high in the hierarchy, which is done here, thus avoiding context issues. - CSS was odd due to a code path removing main container styling for mobile display, everything has been cleaned with explicit and durable naming. I used "main container layout" instead of "page layout" to disambiguate from page layout feature. ## Before <img width="567" height="907" alt="image" src="https://github.com/user-attachments/assets/73a335f6-d5b6-4e8a-a33f-73aa624c7ca5" /> ## After <img width="566" height="907" alt="image" src="https://github.com/user-attachments/assets/0433b7d8-c8de-4b2b-b3fd-0d8d45b92d75" />
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { CommandMenuOpenContainer } from '@/command-menu/components/CommandMenuOpenContainer';
|
||||
import { CommandMenuRouter } from '@/command-menu/components/CommandMenuRouter';
|
||||
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { AnimatePresence } from 'framer-motion';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
const StyledCommandMenuMobileFullScreenContainer = styled.div`
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export const CommandMenuForMobile = () => {
|
||||
const isCommandMenuOpened = useRecoilValue(isCommandMenuOpenedState);
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{isCommandMenuOpened && (
|
||||
<>
|
||||
{createPortal(
|
||||
<StyledCommandMenuMobileFullScreenContainer>
|
||||
<CommandMenuOpenContainer>
|
||||
<CommandMenuRouter />
|
||||
</CommandMenuOpenContainer>
|
||||
</StyledCommandMenuMobileFullScreenContainer>,
|
||||
document.body,
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
};
|
||||
+1
-1
@@ -53,7 +53,7 @@ const StyledModalContainer = styled.div`
|
||||
|
||||
const GAP_WIDTH = 8;
|
||||
|
||||
export const CommandMenuSidePanel = () => {
|
||||
export const CommandMenuSidePanelForDesktop = () => {
|
||||
const isCommandMenuOpened = useRecoilValue(isCommandMenuOpenedState);
|
||||
const isCommandMenuClosing = useRecoilValue(isCommandMenuClosingState);
|
||||
const [commandMenuWidth, setCommandMenuWidth] = useRecoilState(
|
||||
Reference in New Issue
Block a user