Skip to content

Commit

Permalink
Add button to slim player controls to toggle info box
Browse files Browse the repository at this point in the history
  • Loading branch information
tf committed Aug 9, 2017
1 parent 7fc019e commit d8401d7
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ $classic-player-controls-timestamp-position: "left" !default;
}
}

&-page_with_progress_bar {
&-page-with_progress_bar {
%player_controls-control_bar_text {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
&-menu_bar {
right: 10px;
}

&-toggle_info_box_menu_button {
display: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@
right: 20px;
}
}

%player_controls-page-audio .player_controls-toggle_info_box_menu_button {
display: none;
}

@include phone {
.player_controls-toggle_info_box_menu_button {
display: none;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Map placeholder names to concrete vjs css class names.

$vjs-selector-mapping: (
page_with_progress_bar: ".audioPage, .videoPage",
page-with_progress_bar: ".audioPage, .videoPage",
page-audio: ".audioPage",

background: ".page_background-for_page_with_player_controls",

Expand Down
4 changes: 4 additions & 0 deletions config/locales/new/toggle_info_box.de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
de:
pageflow:
public:
toggle_info_box: "Info Box ein-/ausblenden"
4 changes: 4 additions & 0 deletions config/locales/new/toggle_info_box.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
en:
pageflow:
public:
toggle_info_box: "Toggle info box"
23 changes: 22 additions & 1 deletion node_package/src/media/components/PlayerControls.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import playerStateClassNames from './playerStateClassNames';
import PlayerControls from 'components/PlayerControls';
import PlayerControls, {isInfoBoxEmpty} from 'components/PlayerControls';
import {combineSelectors} from 'utils';

import {videoQualitySetting} from 'media/selectors';
Expand Down Expand Up @@ -50,7 +50,11 @@ export function MediaPlayerControls(props) {
watchVisibility={playerState.isPlaying}
onHidden={actions.controlsHidden}

additionalMenuBarButtons={additionalMenuBarButtons(props)}
infoBoxHiddenDuringPlayback={infoBoxHiddenDuringPlayback(props)}
onAdditionalButtonMouseEnter={actions.showInfoBoxDuringPlayback}
onAdditionalButtonMouseLeave={actions.hideInfoBoxDuringPlayback}
onAdditionalButtonClick={actions.toggleInfoBoxDuringPlayback}

qualityMenuItems={qualityMenuItems(props.qualities,
props.file,
Expand Down Expand Up @@ -92,6 +96,23 @@ function className(playerState) {
return classNames(playerStateClassNames(playerState));
}

function additionalMenuBarButtons(props) {
const t = props.t;

if (isInfoBoxEmpty(props.infoBox)) {
return [];
}

return [
{
name: 'toggleInfoBox',
className: 'player_controls-toggle_info_box_menu_button',
label: t('pageflow.public.toggle_info_box'),
iconName: 'toggleInfoBox'
}
];
}

function infoBoxHiddenDuringPlayback(props) {
const playerState = props.playerState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('PlayerControls', () => {
const requiredProps = {
playerState: {},
playerActions: {},
infoBox: {},
t: () => {}
};

Expand Down

0 comments on commit d8401d7

Please sign in to comment.