convert nav-bar component
This commit is contained in:
parent
396cacffad
commit
608485d027
@ -1,13 +1,10 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import cx from 'classnames';
|
|
||||||
import { withModalMounter } from '/imports/ui/components/modal/service';
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
||||||
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
||||||
import getFromUserSettings from '/imports/ui/services/users-settings';
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import Icon from '../icon/component';
|
import Styled from './styles';
|
||||||
import { styles } from './styles.scss';
|
|
||||||
import Button from '/imports/ui/components/button/component';
|
|
||||||
import RecordingIndicator from './recording-indicator/container';
|
import RecordingIndicator from './recording-indicator/container';
|
||||||
import TalkingIndicatorContainer from '/imports/ui/components/nav-bar/talking-indicator/container';
|
import TalkingIndicatorContainer from '/imports/ui/components/nav-bar/talking-indicator/container';
|
||||||
import ConnectionStatusButton from '/imports/ui/components/connection-status/button/container';
|
import ConnectionStatusButton from '/imports/ui/components/connection-status/button/container';
|
||||||
@ -131,7 +128,6 @@ class NavBar extends Component {
|
|||||||
const {
|
const {
|
||||||
hasUnreadMessages,
|
hasUnreadMessages,
|
||||||
hasUnreadNotes,
|
hasUnreadNotes,
|
||||||
// isExpanded,
|
|
||||||
intl,
|
intl,
|
||||||
shortcuts: TOGGLE_USERLIST_AK,
|
shortcuts: TOGGLE_USERLIST_AK,
|
||||||
mountModal,
|
mountModal,
|
||||||
@ -143,9 +139,6 @@ class NavBar extends Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const hasNotification = hasUnreadMessages || hasUnreadNotes;
|
const hasNotification = hasUnreadMessages || hasUnreadNotes;
|
||||||
const toggleBtnClasses = {};
|
|
||||||
toggleBtnClasses[styles.btn] = true;
|
|
||||||
toggleBtnClasses[styles.btnWithNotificationDot] = hasNotification;
|
|
||||||
|
|
||||||
let ariaLabel = intl.formatMessage(intlMessages.toggleUserListAria);
|
let ariaLabel = intl.formatMessage(intlMessages.toggleUserListAria);
|
||||||
ariaLabel += hasNotification ? (` ${intl.formatMessage(intlMessages.newMessages)}`) : '';
|
ariaLabel += hasNotification ? (` ${intl.formatMessage(intlMessages.newMessages)}`) : '';
|
||||||
@ -153,8 +146,7 @@ class NavBar extends Component {
|
|||||||
const isExpanded = sidebarNavigation.isOpen;
|
const isExpanded = sidebarNavigation.isOpen;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header
|
<Styled.Navbar
|
||||||
className={styles.navbar}
|
|
||||||
style={
|
style={
|
||||||
main === 'new'
|
main === 'new'
|
||||||
? {
|
? {
|
||||||
@ -171,11 +163,11 @@ class NavBar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className={styles.top}>
|
<Styled.Top>
|
||||||
<div className={styles.left}>
|
<Styled.Left>
|
||||||
{!isExpanded ? null
|
{!isExpanded ? null
|
||||||
: <Icon iconName="left_arrow" className={styles.arrowLeft} />}
|
: <Styled.ArrowLeft iconName="left_arrow" />}
|
||||||
<Button
|
<Styled.NavbarToggleButton
|
||||||
onClick={this.handleToggleUserList}
|
onClick={this.handleToggleUserList}
|
||||||
ghost
|
ghost
|
||||||
circle
|
circle
|
||||||
@ -185,30 +177,29 @@ class NavBar extends Component {
|
|||||||
tooltipLabel={intl.formatMessage(intlMessages.toggleUserListLabel)}
|
tooltipLabel={intl.formatMessage(intlMessages.toggleUserListLabel)}
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
icon="user"
|
icon="user"
|
||||||
className={cx(toggleBtnClasses)}
|
|
||||||
aria-expanded={isExpanded}
|
aria-expanded={isExpanded}
|
||||||
accessKey={TOGGLE_USERLIST_AK}
|
accessKey={TOGGLE_USERLIST_AK}
|
||||||
|
hasNotification={hasNotification}
|
||||||
/>
|
/>
|
||||||
{isExpanded ? null
|
{isExpanded ? null
|
||||||
: <Icon iconName="right_arrow" className={styles.arrowRight} />}
|
: <Styled.ArrowRight iconName="right_arrow" />}
|
||||||
</div>
|
</Styled.Left>
|
||||||
<div className={styles.center}>
|
<Styled.Center>
|
||||||
<h1 className={styles.presentationTitle}>{presentationTitle}</h1>
|
<Styled.PresentationTitle>{presentationTitle}</Styled.PresentationTitle>
|
||||||
|
|
||||||
<RecordingIndicator
|
<RecordingIndicator
|
||||||
mountModal={mountModal}
|
mountModal={mountModal}
|
||||||
amIModerator={amIModerator}
|
amIModerator={amIModerator}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Styled.Center>
|
||||||
<div className={styles.right}>
|
<Styled.Right>
|
||||||
{ConnectionStatusService.isEnabled() ? <ConnectionStatusButton /> : null}
|
{ConnectionStatusService.isEnabled() ? <ConnectionStatusButton /> : null}
|
||||||
<SettingsDropdownContainer amIModerator={amIModerator} />
|
<SettingsDropdownContainer amIModerator={amIModerator} />
|
||||||
</div>
|
</Styled.Right>
|
||||||
</div>
|
</Styled.Top>
|
||||||
<div className={styles.bottom}>
|
<Styled.Bottom>
|
||||||
<TalkingIndicatorContainer amIModerator={amIModerator} />
|
<TalkingIndicatorContainer amIModerator={amIModerator} />
|
||||||
</div>
|
</Styled.Bottom>
|
||||||
</header>
|
</Styled.Navbar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import ShortcutHelpComponent from '/imports/ui/components/shortcut-help/componen
|
|||||||
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
||||||
import FullscreenService from '../../fullscreen-button/service';
|
import FullscreenService from '../../fullscreen-button/service';
|
||||||
|
|
||||||
import { styles } from '../styles';
|
import { styles } from '../styles.scss';
|
||||||
|
|
||||||
const intlMessages = defineMessages({
|
const intlMessages = defineMessages({
|
||||||
optionsLabel: {
|
optionsLabel: {
|
||||||
|
154
bigbluebutton-html5/imports/ui/components/nav-bar/styles.js
Normal file
154
bigbluebutton-html5/imports/ui/components/nav-bar/styles.js
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
import Icon from '../icon/component';
|
||||||
|
import {
|
||||||
|
barsPadding,
|
||||||
|
lgPaddingY,
|
||||||
|
mdPaddingX,
|
||||||
|
borderSize,
|
||||||
|
} from '/imports/ui/stylesheets/styled-components/general';
|
||||||
|
import {
|
||||||
|
colorWhite,
|
||||||
|
colorDanger,
|
||||||
|
colorGrayDark,
|
||||||
|
} from '/imports/ui/stylesheets/styled-components/palette';
|
||||||
|
import { fontSizeBase } from '/imports/ui/stylesheets/styled-components/typography';
|
||||||
|
import { phoneLandscape } from '/imports/ui/stylesheets/styled-components/breakpoints';
|
||||||
|
import Button from '/imports/ui/components/button/component';
|
||||||
|
|
||||||
|
const Navbar = styled.header`
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
padding: ${barsPadding} ${barsPadding} 0 ${barsPadding};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Top = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Left = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ArrowLeft = styled(Icon)`
|
||||||
|
position: absolute;
|
||||||
|
font-size: 40%;
|
||||||
|
color: ${colorWhite};
|
||||||
|
|
||||||
|
width: ${lgPaddingY};
|
||||||
|
left: 1.1rem;
|
||||||
|
[dir="rtl"] & {
|
||||||
|
right: 2.5rem;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ArrowRight = styled(Icon)`
|
||||||
|
position: absolute;
|
||||||
|
font-size: 40%;
|
||||||
|
color: ${colorWhite};
|
||||||
|
|
||||||
|
width: ${mdPaddingX};
|
||||||
|
left: 2.5rem;
|
||||||
|
[dir="rtl"] & {
|
||||||
|
right: .5rem;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Center = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 70%;
|
||||||
|
flex: 1;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const PresentationTitle = styled.h1`
|
||||||
|
font-weight: 200;
|
||||||
|
color: ${colorWhite};
|
||||||
|
font-size: ${fontSizeBase};
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 30vw;
|
||||||
|
|
||||||
|
> [class^="icon-bbb-"] {
|
||||||
|
font-size: 75%;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Right = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex: 0;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Bottom = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
@media ${phoneLandscape} {
|
||||||
|
margin-top: .25rem;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const NavbarToggleButton = styled(Button)`
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
span {
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
z-index: 3;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
span {
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: ${colorWhite} !important;
|
||||||
|
opacity: .75;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${({ hasNotification }) => hasNotification && `
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
bottom: ${borderSize};
|
||||||
|
right: 3px;
|
||||||
|
background-color: ${colorDanger};
|
||||||
|
border: ${borderSize} solid ${colorGrayDark};
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
Navbar,
|
||||||
|
Top,
|
||||||
|
Left,
|
||||||
|
ArrowLeft,
|
||||||
|
ArrowRight,
|
||||||
|
Center,
|
||||||
|
PresentationTitle,
|
||||||
|
Right,
|
||||||
|
Bottom,
|
||||||
|
NavbarToggleButton,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user