refactor isMobile check in actions-dropdown

This commit is contained in:
Ramón Souza 2022-03-03 17:46:20 +00:00
parent 7fc2c96d2a
commit 6d268c4092
3 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,6 @@ import RandomUserSelectContainer from '/imports/ui/components/common/modal/rando
import BBBMenu from '/imports/ui/components/common/menu/component';
import Styled from './styles'
import { PANELS, ACTIONS } from '../../layout/enums';
import deviceInfo from '/imports/utils/deviceInfo';
import { colorPrimary } from '/imports/ui/stylesheets/styled-components/palette';
const propTypes = {
@ -250,6 +249,7 @@ class ActionsDropdown extends PureComponent {
shortcuts: OPEN_ACTIONS_AK,
isMeteorConnected,
isDropdownOpen,
isMobile,
} = this.props;
const availableActions = this.getAvailableActions();
@ -262,7 +262,6 @@ class ActionsDropdown extends PureComponent {
|| !isMeteorConnected) {
return null;
}
const { isMobile } = deviceInfo;
const customStyles = { top: '-3rem' };
return (

View File

@ -6,10 +6,13 @@ import PresentationPodService from '/imports/ui/components/presentation-pod/serv
import ActionsDropdown from './component';
import { layoutSelectInput, layoutDispatch } from '../../layout/context';
import getFromUserSettings from '/imports/ui/services/users-settings';
import { SMALL_VIEWPORT_BREAKPOINT } from '../../layout/enums';
const ActionsDropdownContainer = (props) => {
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
const sidebarNavigation = layoutSelectInput((i) => i.sidebarNavigation);
const { width: browserWidth } = layoutSelectInput((i) => i.browser);
const isMobile = browserWidth <= SMALL_VIEWPORT_BREAKPOINT;
const layoutContextDispatch = layoutDispatch();
return (
@ -17,6 +20,7 @@ const ActionsDropdownContainer = (props) => {
layoutContextDispatch,
sidebarContent,
sidebarNavigation,
isMobile,
...props,
}}
/>

View File

@ -13,6 +13,8 @@ export const DEVICE_TYPE = {
DESKTOP: 'desktop',
};
export const SMALL_VIEWPORT_BREAKPOINT = 640;
export const CAMERADOCK_POSITION = {
CONTENT_TOP: 'contentTop',
CONTENT_RIGHT: 'contentRight',