feat(toolbox): Redesign.

This commit is contained in:
Hristo Terezov 2019-02-20 23:35:19 +00:00
parent 4312512d2f
commit f7b930409b
3 changed files with 291 additions and 224 deletions

View File

@ -23,192 +23,241 @@
* TODO: when the old filmstrip has been removed, remove the "new-" prefix. * TODO: when the old filmstrip has been removed, remove the "new-" prefix.
*/ */
.new-toolbox { .new-toolbox {
background-color: $newToolbarBackgroundColor;
bottom: calc((#{$newToolbarSize} * 2) * -1); bottom: calc((#{$newToolbarSize} * 2) * -1);
box-sizing: border-box;
display: flex;
justify-content: space-between;
left: 0; left: 0;
margin-left: auto;
margin-right: auto;
padding: 12px 8px;
position: absolute; position: absolute;
right: 0; right: 0;
transition: bottom .3s ease-in; transition: bottom .3s ease-in;
width: 100%; width: 100%;
z-index: $toolbarZ;
&.visible { &.visible {
bottom: 0; bottom: 0;
.toolbox-background {
bottom: 0px;
}
} }
&.no-buttons { &.no-buttons {
display: none; display: none;
} }
.button-group-center, .toolbox-background {
.button-group-left, background-image: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
.button-group-right { transition: bottom .3s ease-in;
display: flex; height: 160px;
width: 33%;
}
.button-group-center {
justify-content: center;
}
.button-group-right {
justify-content: flex-end;
}
i {
border-radius: 5px;
cursor: pointer;
display: block;
font-size: inherit;
height: 100%;
line-height: inherit;
width: 100%; width: 100%;
bottom: -160px;
position: absolute;
z-index: $toolbarBackgroundZ;
} }
i:hover { .toolbox-content {
background-color: $newToolbarButtonHoverColor; box-sizing: border-box;
} display: flex;
justify-content: space-between;
margin-left: auto;
margin-right: auto;
padding: 20px 16px;
position: relative;
width: 100%;
z-index: $toolbarZ;
i.toggled { .button-group-center,
background: $newToolbarButtonToggleColor; .button-group-left,
} .button-group-right {
i.toggled:hover {
background-color: $newToolbarButtonHoverColor;
}
i.disabled {
cursor: initial;
color: #3b475c;
}
.disabled i {
cursor: initial;
color: #3b475c;
}
i.disabled:hover {
background-color: initial;
}
.icon-hangup {
color: $hangupColor;
font-size: $newToolbarHangupFontSize;
}
.overflow-menu {
font-size: 1.2em;
list-style-type: none;
/**
* Undo atlaskit padding by reducing margins.
*/
margin: -15px -24px;
padding: 4px 0;
.overflow-menu-item {
align-items: center;
color: #B8C7E0;
cursor: pointer;
display: flex; display: flex;
font-size: 14px; width: 33%;
height: 22px; }
padding: 5px 12px;
div { .button-group-center {
display: flex; justify-content: center;
flex-direction: row; .toolbox-icon {
align-items: center; margin: 0px 12px;
} }
}
.button-group-right {
justify-content: flex-end;
}
i {
border-radius: 5px;
cursor: pointer;
display: block;
font-size: inherit;
height: 100%;
line-height: inherit;
width: 100%;
}
i:hover {
background: $newToolbarButtonHoverColor;
}
i.toggled {
background: $newToolbarButtonToggleColor;
}
i.toggled:hover {
background: $newToolbarButtonHoverColor;
}
.icon-hangup {
background-color: #e12d2d;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
&:hover { &:hover {
background: #313D52; background-color: #e54b4b;
}
}
i.disabled, .disabled i {
cursor: initial;
color: #fff;
background-color: #a4b8d1;
}
.icon-mic-disabled, .icon-microphone, .icon-camera-disabled, .icon-camera {
background-color: #fff;
color: #5e6d7a;
border-radius: 50%;
border: 1px solid #d1dbe8;
width: 38px;
height: 38px;
&:hover {
background-color: #daebfa;
border: 1px solid #daebfa;
} }
&.unclickable { &.toggled {
cursor: default; background: #2a3a4b;
color: #fff;
border: 1px solid #5e6d7a;
&:hover {
background-color: #5e6d7a;
}
} }
&.unclickable:hover {
background: inherit; &.disabled, .disabled & {
}
&.disabled {
cursor: initial; cursor: initial;
color: #3b475c; color: #fff;
background-color: #a4b8d1;
} }
} }
.beta-tag { .overflow-menu {
background: #B8C7E0; font-size: 1.2em;
border-radius: 2px; list-style-type: none;
color: $newToolbarBackgroundColor; /**
font-size: 11px; * Undo atlaskit padding by reducing margins.
font-weight: bold; */
margin-left: 8px; margin: -15px -24px;
padding: 0 6px; padding: 4px 0;
}
.overflow-menu-item-icon { .overflow-menu-item {
margin-right: 10px; align-items: center;
color: #B8C7E0;
cursor: pointer;
display: flex;
font-size: 14px;
height: 22px;
padding: 5px 12px;
i { div {
display: inline; display: flex;
font-size: 24px; flex-direction: row;
align-items: center;
}
&:hover {
background: #313D52;
}
&.unclickable {
cursor: default;
}
&.unclickable:hover {
background: inherit;
}
&.disabled {
cursor: initial;
color: #3b475c;
}
} }
i:hover { .beta-tag {
background-color: initial; background: #B8C7E0;
border-radius: 2px;
color: $newToolbarBackgroundColor;
font-size: 11px;
font-weight: bold;
margin-left: 8px;
padding: 0 6px;
} }
img { .overflow-menu-item-icon {
max-width: 24px; margin-right: 10px;
max-height: 24px;
i {
display: inline;
font-size: 24px;
}
i:hover {
background-color: initial;
}
img {
max-width: 24px;
max-height: 24px;
}
}
.profile-text {
max-width: 150px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
} }
} }
.profile-text { .toolbox-button {
max-width: 150px; color: $toolbarButtonColor;
text-overflow: ellipsis; cursor: pointer;
overflow: hidden; display: inline-block;
white-space: nowrap; line-height: $newToolbarSize;
margin: 0 8px;
text-align: center;
} }
}
.toolbox-button { .toolbar-button-with-badge {
color: $toolbarButtonColor; position: relative;
cursor: pointer;
display: inline-block;
line-height: $newToolbarSize;
margin: 0 4px;
text-align: center;
}
.toolbar-button-with-badge { .badge-round {
position: relative; bottom: -5px;
font-size: 12px;
.badge-round { line-height: 20px;
bottom: -5px; min-width: 20px;
font-size: 12px; pointer-events: none;
line-height: 20px; position: absolute;
min-width: 20px; right: -5px;
pointer-events: none; }
position: absolute;
right: -5px;
} }
}
.toolbox-button-wth-dialog { .toolbox-button-wth-dialog {
display: inline-block; display: inline-block;
} }
.toolbox-icon { .toolbox-icon {
height: $newToolbarSize; height: $newToolbarSize;
font-size: 24px; font-size: 24px;
width: $newToolbarSize; width: $newToolbarSize;
}
} }
} }
@ -226,15 +275,15 @@
} }
i:hover { i:hover {
background-color: $newToolbarButtonHoverColor; background-color: $AOTToolbarButtonHoverColor;
} }
i.toggled { i.toggled {
background: $newToolbarButtonToggleColor; background: $AOTToolbarButtonToggleColor;
} }
i.toggled:hover:not(.disabled) { i.toggled:hover:not(.disabled) {
background-color: $newToolbarButtonHoverColor; background-color: $AOTToolbarButtonHoverColor;
} }
.icon-hangup { .icon-hangup {

View File

@ -34,8 +34,10 @@ $defaultDarkColor: #2b3d5c;
*/ */
$defaultToolbarSize: 50px; $defaultToolbarSize: 50px;
$newToolbarBackgroundColor: rgba(22, 38, 55, 0.8); $newToolbarBackgroundColor: rgba(22, 38, 55, 0.8);
$newToolbarButtonHoverColor: rgba(14, 20, 35, 0.6); $newToolbarButtonHoverColor: rgba(42, 58, 75, 0.15);
$newToolbarButtonToggleColor: rgba(14, 20, 35, 1); $newToolbarButtonToggleColor: rgba(42, 58, 75, 0.2);
$AOTToolbarButtonHoverColor: rgba(14, 20, 35, 0.6);
$AOTToolbarButtonToggleColor: rgba(14, 20, 35, 1);
$newToolbarFontSize: 24px; $newToolbarFontSize: 24px;
$newToolbarHangupFontSize: 32px; $newToolbarHangupFontSize: 32px;
$newToolbarSize: 40px; $newToolbarSize: 40px;
@ -91,6 +93,7 @@ $zindex0: 0;
$zindex1: 1; $zindex1: 1;
$zindex2: 2; $zindex2: 2;
$zindex3: 3; $zindex3: 3;
$toolbarBackgroundZ: 4;
$filmstripVideosZ: 5; $filmstripVideosZ: 5;
$zindex10: 10; $zindex10: 10;
$reloadZ: 20; $reloadZ: 20;

View File

@ -312,21 +312,9 @@ class Toolbox extends Component<Props> {
* @returns {ReactElement} * @returns {ReactElement}
*/ */
render() { render() {
const { const { _visible, _visibleButtons } = this.props;
_chatOpen,
_hideInviteButton,
_overflowMenuVisible,
_raisedHand,
_visible,
_visibleButtons,
t
} = this.props;
const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${ const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
_visibleButtons.size ? '' : 'no-buttons'}`; _visibleButtons.size ? '' : 'no-buttons'}`;
const overflowMenuContent = this._renderOverflowMenuContent();
const overflowHasItems = Boolean(overflowMenuContent.filter(
child => child).length);
const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
return ( return (
<div <div
@ -334,72 +322,8 @@ class Toolbox extends Component<Props> {
id = 'new-toolbox' id = 'new-toolbox'
onMouseOut = { this._onMouseOut } onMouseOut = { this._onMouseOut }
onMouseOver = { this._onMouseOver }> onMouseOver = { this._onMouseOver }>
<div className = 'button-group-left'> <div className = 'toolbox-background' />
{ this._shouldShowButton('desktop') { this._renderToolboxContent() }
&& this._renderDesktopSharingButton() }
{ this._shouldShowButton('raisehand')
&& <ToolbarButton
accessibilityLabel =
{ t('toolbar.accessibilityLabel.raiseHand') }
iconName = { _raisedHand
? 'icon-raised-hand toggled'
: 'icon-raised-hand' }
onClick = { this._onToolbarToggleRaiseHand }
tooltip = { t('toolbar.raiseHand') } /> }
{ this._shouldShowButton('chat')
&& <div className = 'toolbar-button-with-badge'>
<ToolbarButton
accessibilityLabel =
{ t('toolbar.accessibilityLabel.chat') }
iconName = { _chatOpen
? 'icon-chat toggled'
: 'icon-chat' }
onClick = { this._onToolbarToggleChat }
tooltip = { t('toolbar.chat') } />
<ChatCounter />
</div> }
{
this._shouldShowButton('closedcaptions')
&& <ClosedCaptionButton />
}
</div>
<div className = 'button-group-center'>
<AudioMuteButton
visible = { this._shouldShowButton('microphone') } />
<HangupButton
visible = { this._shouldShowButton('hangup') } />
<VideoMuteButton
visible = { this._shouldShowButton('camera') } />
</div>
<div className = 'button-group-right'>
{ this._shouldShowButton('localrecording')
&& <LocalRecordingButton
onClick = {
this._onToolbarOpenLocalRecordingInfoDialog
} />
}
{ this._shouldShowButton('tileview')
&& <TileViewButton /> }
{ this._shouldShowButton('invite')
&& !_hideInviteButton
&& <ToolbarButton
accessibilityLabel =
{ t('toolbar.accessibilityLabel.invite') }
iconName = 'icon-add'
onClick = { this._onToolbarOpenInvite }
tooltip = { t('toolbar.invite') } /> }
{ this._shouldShowButton('info') && <InfoDialogButton /> }
{ overflowHasItems
&& <OverflowMenuButton
isOpen = { _overflowMenuVisible }
onVisibilityChange = { this._onSetOverflowVisible }>
<ul
aria-label = { t(toolbarAccLabel) }
className = 'overflow-menu'>
{ overflowMenuContent }
</ul>
</OverflowMenuButton> }
</div>
</div> </div>
); );
} }
@ -1000,6 +924,97 @@ class Toolbox extends Component<Props> {
]; ];
} }
/**
* Renders the toolbox content.
*
* @returns {Array<ReactElement>}
*/
_renderToolboxContent() {
const {
_chatOpen,
_hideInviteButton,
_overflowMenuVisible,
_raisedHand,
t
} = this.props;
const overflowMenuContent = this._renderOverflowMenuContent();
const overflowHasItems = Boolean(overflowMenuContent.filter(
child => child).length);
const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
return (
<div className = 'toolbox-content'>
<div className = 'button-group-left'>
{ this._shouldShowButton('desktop')
&& this._renderDesktopSharingButton() }
{ this._shouldShowButton('raisehand')
&& <ToolbarButton
accessibilityLabel =
{
t('toolbar.accessibilityLabel.raiseHand')
}
iconName = { _raisedHand
? 'icon-raised-hand toggled'
: 'icon-raised-hand' }
onClick = { this._onToolbarToggleRaiseHand }
tooltip = { t('toolbar.raiseHand') } /> }
{ this._shouldShowButton('chat')
&& <div className = 'toolbar-button-with-badge'>
<ToolbarButton
accessibilityLabel =
{ t('toolbar.accessibilityLabel.chat') }
iconName = { _chatOpen
? 'icon-chat toggled'
: 'icon-chat' }
onClick = { this._onToolbarToggleChat }
tooltip = { t('toolbar.chat') } />
<ChatCounter />
</div> }
{
this._shouldShowButton('closedcaptions')
&& <ClosedCaptionButton />
}
</div>
<div className = 'button-group-center'>
<AudioMuteButton
visible = { this._shouldShowButton('microphone') } />
<HangupButton
visible = { this._shouldShowButton('hangup') } />
<VideoMuteButton
visible = { this._shouldShowButton('camera') } />
</div>
<div className = 'button-group-right'>
{ this._shouldShowButton('localrecording')
&& <LocalRecordingButton
onClick = {
this._onToolbarOpenLocalRecordingInfoDialog
} />
}
{ this._shouldShowButton('tileview')
&& <TileViewButton /> }
{ this._shouldShowButton('invite')
&& !_hideInviteButton
&& <ToolbarButton
accessibilityLabel =
{ t('toolbar.accessibilityLabel.invite') }
iconName = 'icon-add'
onClick = { this._onToolbarOpenInvite }
tooltip = { t('toolbar.invite') } /> }
{ this._shouldShowButton('info') && <InfoDialogButton /> }
{ overflowHasItems
&& <OverflowMenuButton
isOpen = { _overflowMenuVisible }
onVisibilityChange = { this._onSetOverflowVisible }>
<ul
aria-label = { t(toolbarAccLabel) }
className = 'overflow-menu'>
{ overflowMenuContent }
</ul>
</OverflowMenuButton> }
</div>
</div>);
}
_shouldShowButton: (string) => boolean; _shouldShowButton: (string) => boolean;
/** /**