From 0d4a1ce0ef8dc1fbfcd888be1fa0fc642522c321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Souza?= Date: Fri, 5 Nov 2021 18:38:01 +0000 Subject: [PATCH] convert nav-bar settings-dropdown component --- .../imports/ui/components/menu/component.jsx | 25 +++++++++++-- .../nav-bar/settings-dropdown/component.jsx | 21 ++++++----- .../nav-bar/settings-dropdown/styles.js | 35 +++++++++++++++++++ 3 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/styles.js diff --git a/bigbluebutton-html5/imports/ui/components/menu/component.jsx b/bigbluebutton-html5/imports/ui/components/menu/component.jsx index 207334db15..5539a05d99 100644 --- a/bigbluebutton-html5/imports/ui/components/menu/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/menu/component.jsx @@ -65,6 +65,19 @@ class BBBMenu extends React.Component { if (key?.toLowerCase()?.includes(selectedEmoji?.toLowerCase())) itemClasses.push(styles.emojiSelected); + let customStyles = { + paddingLeft: '4px', + paddingRight: '4px', + paddingTop: '8px', + paddingBottom: '8px', + marginLeft: '4px', + marginRight: '4px' + }; + + if (a.customStyles) { + customStyles = { ...customStyles, ...a.customStyles }; + } + return [ a.dividerTop && , { onClick(); const close = !key.includes('setstatus') && !key.includes('back'); @@ -94,12 +107,18 @@ class BBBMenu extends React.Component { render() { const { anchorEl } = this.state; - const { trigger, intl, wide, classes } = this.props; + const { trigger, intl, wide, classes, customStyles } = this.props; const actionsItems = this.makeMenuItems(); const menuClasses = classes || []; menuClasses.push(styles.menu); if (wide) menuClasses.push(styles.wide); + let menuStyles = { zIndex: 9999 }; + + if (customStyles) { + menuStyles = { ...menuStyles, ...customStyles }; + } + return ( <>
{actionsItems} {anchorEl && window.innerWidth < MAX_WIDTH && diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx index a094a7b0b6..6220a51713 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx @@ -6,13 +6,13 @@ import EndMeetingConfirmationContainer from '/imports/ui/components/end-meeting- import { makeCall } from '/imports/ui/services/api'; import AboutContainer from '/imports/ui/components/about/container'; import SettingsMenuContainer from '/imports/ui/components/settings/container'; -import Button from '/imports/ui/components/button/component'; import BBBMenu from '/imports/ui/components/menu/component'; import ShortcutHelpComponent from '/imports/ui/components/shortcut-help/component'; import withShortcutHelper from '/imports/ui/components/shortcut-help/service'; import FullscreenService from '../../fullscreen-button/service'; - -import { styles } from '../styles'; +import { colorDanger } from '/imports/ui/stylesheets/styled-components/palette'; +import deviceInfo from '/imports/utils/deviceInfo'; +import Styled from './styles'; const intlMessages = defineMessages({ optionsLabel: { @@ -252,6 +252,8 @@ class SettingsDropdown extends PureComponent { } if (allowLogoutSetting && isMeteorConnected) { + const customStyles = { color: colorDanger }; + this.menuItems.push( { key: 'list-item-logout', @@ -259,7 +261,7 @@ class SettingsDropdown extends PureComponent { icon: 'logout', label: intl.formatMessage(intlMessages.leaveSessionLabel), // description: intl.formatMessage(intlMessages.leaveSessionDesc), - className: styles.leaveMeetingButton, + customStyles, onClick: () => this.leaveSession(), }, ); @@ -275,19 +277,21 @@ class SettingsDropdown extends PureComponent { isDropdownOpen, } = this.props; - return ( + const { isMobile } = deviceInfo; + const customStyles = { top: '4rem' }; + return ( null} @@ -295,7 +299,6 @@ class SettingsDropdown extends PureComponent { )} actions={this.renderMenuItems()} /> - ); } } diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/styles.js b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/styles.js new file mode 100644 index 0000000000..365e51e046 --- /dev/null +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/styles.js @@ -0,0 +1,35 @@ +import styled from 'styled-components'; +import { smallOnly } from '/imports/ui/stylesheets/styled-components/breakpoints'; +import Button from '/imports/ui/components/button/component'; + +const DropdownButton = styled(Button)` + ${({ state }) => state === 'open' && ` + @media ${smallOnly} { + display: none; + } + `} + + ${({ state }) => state === 'closed' && ` + margin: 0; + + & span { + border: none; + box-shadow: none; + } + + z-index: 3; + + &:hover, + &:focus { + span { + background-color: transparent !important; + color: var(--color-white) !important; + opacity: .75; + } + } + `} +`; + +export default { + DropdownButton, +};