Search dialog fullscreen on mobile (#5765)
I changed the visibility of the search dialog to make it full screen on mobile, this should already be ok but I couldn't try it on mobile, so I just used devtools, if I need to do something else on this PR just tell me :) This PR aims to fix: #5746 --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -35,19 +35,16 @@ import { CommandMenuItem } from './CommandMenuItem';
|
|||||||
|
|
||||||
export const StyledDialog = styled.div`
|
export const StyledDialog = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
border: 1px solid ${({ theme }) => theme.border.color.medium};
|
border-left: 1px solid ${({ theme }) => theme.border.color.medium};
|
||||||
border-radius: ${({ theme }) => theme.border.radius.md};
|
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
||||||
box-shadow: ${({ theme }) => theme.boxShadow.superHeavy};
|
|
||||||
font-family: ${({ theme }) => theme.font.family};
|
font-family: ${({ theme }) => theme.font.family};
|
||||||
left: 50%;
|
height: 100%;
|
||||||
max-width: 640px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 30%;
|
right: 0%;
|
||||||
transform: ${() =>
|
top: 0%;
|
||||||
useIsMobile() ? 'translateX(-49.5%)' : 'translateX(-50%)'};
|
width: ${() => (useIsMobile() ? '100%' : '500px')};
|
||||||
width: ${() => (useIsMobile() ? 'calc(100% - 40px)' : '100%')};
|
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -60,7 +57,8 @@ export const StyledInput = styled.input`
|
|||||||
font-size: ${({ theme }) => theme.font.size.lg};
|
font-size: ${({ theme }) => theme.font.size.lg};
|
||||||
margin: 0;
|
margin: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding: ${({ theme }) => theme.spacing(5)};
|
height: 24px;
|
||||||
|
padding: ${({ theme }) => theme.spacing(4)};
|
||||||
width: ${({ theme }) => `calc(100% - ${theme.spacing(10)})`};
|
width: ${({ theme }) => `calc(100% - ${theme.spacing(10)})`};
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
@ -80,8 +78,6 @@ const StyledCancelText = styled.span`
|
|||||||
|
|
||||||
export const StyledList = styled.div`
|
export const StyledList = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
height: 400px;
|
|
||||||
max-height: 400px;
|
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
transition: 100ms ease;
|
transition: 100ms ease;
|
||||||
transition-property: height;
|
transition-property: height;
|
||||||
@ -119,6 +115,8 @@ export const CommandMenu = () => {
|
|||||||
setCommandMenuSearch(event.target.value);
|
setCommandMenuSearch(event.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isMobile = useIsMobile();
|
||||||
|
|
||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
'ctrl+k,meta+k',
|
'ctrl+k,meta+k',
|
||||||
() => {
|
() => {
|
||||||
@ -267,7 +265,7 @@ export const CommandMenu = () => {
|
|||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
onChange={handleSearchChange}
|
onChange={handleSearchChange}
|
||||||
/>
|
/>
|
||||||
<StyledCancelText>Esc to cancel</StyledCancelText>
|
{!isMobile && <StyledCancelText>Esc to cancel</StyledCancelText>}
|
||||||
<StyledList>
|
<StyledList>
|
||||||
<ScrollWrapper>
|
<ScrollWrapper>
|
||||||
<StyledInnerList>
|
<StyledInnerList>
|
||||||
|
|||||||
@ -22,7 +22,7 @@ type NavigationBarItemName = 'main' | 'search' | 'tasks' | 'settings';
|
|||||||
|
|
||||||
export const MobileNavigationBar = () => {
|
export const MobileNavigationBar = () => {
|
||||||
const [isCommandMenuOpened] = useRecoilState(isCommandMenuOpenedState);
|
const [isCommandMenuOpened] = useRecoilState(isCommandMenuOpenedState);
|
||||||
const { closeCommandMenu, toggleCommandMenu } = useCommandMenu();
|
const { closeCommandMenu, openCommandMenu } = useCommandMenu();
|
||||||
const isTasksPage = useIsTasksPage();
|
const isTasksPage = useIsTasksPage();
|
||||||
const isSettingsPage = useIsSettingsPage();
|
const isSettingsPage = useIsSettingsPage();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -62,8 +62,10 @@ export const MobileNavigationBar = () => {
|
|||||||
name: 'search',
|
name: 'search',
|
||||||
Icon: IconSearch,
|
Icon: IconSearch,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
if (!isCommandMenuOpened) {
|
||||||
|
openCommandMenu();
|
||||||
|
}
|
||||||
setIsNavigationDrawerOpen(false);
|
setIsNavigationDrawerOpen(false);
|
||||||
toggleCommandMenu();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import { useTheme } from '@emotion/react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { IconComponent } from 'twenty-ui';
|
import { IconComponent } from 'twenty-ui';
|
||||||
|
|
||||||
|
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
StyledMenuItemLabel,
|
StyledMenuItemLabel,
|
||||||
StyledMenuItemLeftContent,
|
StyledMenuItemLeftContent,
|
||||||
@ -83,6 +85,7 @@ export const MenuItemCommand = ({
|
|||||||
onClick,
|
onClick,
|
||||||
}: MenuItemCommandProps) => {
|
}: MenuItemCommandProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const isMobile = useIsMobile();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledMenuItemCommandContainer
|
<StyledMenuItemCommandContainer
|
||||||
@ -100,10 +103,12 @@ export const MenuItemCommand = ({
|
|||||||
{text}
|
{text}
|
||||||
</StyledMenuItemLabelText>
|
</StyledMenuItemLabelText>
|
||||||
</StyledMenuItemLeftContent>
|
</StyledMenuItemLeftContent>
|
||||||
<MenuItemCommandHotKeys
|
{!isMobile && (
|
||||||
firstHotKey={firstHotKey}
|
<MenuItemCommandHotKeys
|
||||||
secondHotKey={secondHotKey}
|
firstHotKey={firstHotKey}
|
||||||
/>
|
secondHotKey={secondHotKey}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</StyledMenuItemCommandContainer>
|
</StyledMenuItemCommandContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,6 +8,7 @@ const StyledContainer = styled.div`
|
|||||||
gap: ${({ theme }) => theme.spacing(4)};
|
gap: ${({ theme }) => theme.spacing(4)};
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: ${({ theme }) => theme.spacing(3)};
|
padding: ${({ theme }) => theme.spacing(3)};
|
||||||
|
z-index: 1001;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
type NavigationBarProps = {
|
type NavigationBarProps = {
|
||||||
|
|||||||
Reference in New Issue
Block a user