bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-dock/video-menu/component.jsx

77 lines
2.3 KiB
React
Raw Normal View History

2017-09-20 11:12:10 +08:00
import React from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
2017-09-20 11:12:10 +08:00
import Button from '/imports/ui/components/button/component';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import Dropdown from '/imports/ui/components/dropdown/component';
import DropdownTrigger from '/imports/ui/components/dropdown/trigger/component';
import DropdownContent from '/imports/ui/components/dropdown/content/component';
import DropdownList from '/imports/ui/components/dropdown/list/component';
import DropdownListItem from '/imports/ui/components/dropdown/list/item/component';
import { styles } from './styles';
2017-09-20 11:12:10 +08:00
const intlMessages = defineMessages({
videoMenu: {
id: 'app.video.videoMenu',
description: 'video menu label',
2017-09-20 11:12:10 +08:00
},
videoMenuDesc: {
id: 'app.video.videoMenuDesc',
description: 'video menu description',
2017-09-20 11:12:10 +08:00
},
});
2018-01-29 19:52:07 +08:00
const propTypes = {
intl: intlShape.isRequired,
isSharingVideo: PropTypes.bool.isRequired,
videoItems: PropTypes.arrayOf(PropTypes.object).isRequired,
};
const JoinVideoOptions = ({
intl,
isSharingVideo,
videoItems,
}) => {
const menuItems = videoItems
.filter(item => !item.disabled)
.map(item =>
(
<DropdownListItem
key={_.uniqueId('video-menu-')}
className={styles.item}
description={item.description}
onClick={item.click}
tabIndex={-1}
>
<img src={item.iconPath} className={styles.imageSize} alt="video menu icon" />
<span className={styles.label}>{item.label}</span>
</DropdownListItem>
));
return (
<Dropdown
autoFocus
>
<DropdownTrigger tabIndex={0}>
2018-01-29 19:52:07 +08:00
<Button
label={intl.formatMessage(intlMessages.videoMenu)}
onClick={() => null}
2018-01-29 19:52:07 +08:00
hideLabel
aria-label={intl.formatMessage(intlMessages.videoMenuDesc)}
color={isSharingVideo ? 'danger' : 'primary'}
icon={isSharingVideo ? 'video_off' : 'video'}
2018-01-29 19:52:07 +08:00
size="lg"
circle
/>
</DropdownTrigger>
<DropdownContent placement="top" >
<DropdownList horizontal>
{menuItems}
</DropdownList>
</DropdownContent>
</Dropdown>
);
};
JoinVideoOptions.propTypes = propTypes;
export default injectIntl(JoinVideoOptions);