2020-04-16 10:47:10 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
2020-05-07 07:42:55 +00:00
|
|
|
import { Icon, IconArrowDown } from '../../../base/icons';
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
const classNameByType = {
|
|
|
|
primary: 'prejoin-btn--primary',
|
|
|
|
secondary: 'prejoin-btn--secondary',
|
|
|
|
text: 'prejoin-btn--text'
|
|
|
|
};
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Text of the button.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Text css class of the button.
|
|
|
|
*/
|
|
|
|
className?: string,
|
|
|
|
|
2020-05-07 07:42:55 +00:00
|
|
|
/**
|
|
|
|
* If the button has options.
|
|
|
|
*/
|
|
|
|
hasOptions?: boolean,
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
/**
|
|
|
|
* The type of th button: primary, secondary, text.
|
|
|
|
*/
|
|
|
|
type: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OnClick button handler.
|
|
|
|
*/
|
|
|
|
onClick: Function,
|
2020-05-07 07:42:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for options.
|
|
|
|
*/
|
|
|
|
onOptionsClick?: Function
|
2020-04-16 10:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button used for prejoin actions: Join/Join without audio/Join by phone.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
2020-05-07 07:42:55 +00:00
|
|
|
function ActionButton({ children, className, hasOptions, type, onClick, onOptionsClick }: Props) {
|
2020-04-16 10:47:10 +00:00
|
|
|
const ownClassName = `prejoin-btn ${classNameByType[type]}`;
|
|
|
|
const cls = className ? `${className} ${ownClassName}` : ownClassName;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = { cls }
|
|
|
|
onClick = { onClick }>
|
|
|
|
{children}
|
2020-05-07 07:42:55 +00:00
|
|
|
{hasOptions && <div
|
|
|
|
className = 'prejoin-btn-options'
|
|
|
|
onClick = { onOptionsClick }>
|
|
|
|
<Icon
|
|
|
|
className = 'prejoin-btn-icon'
|
|
|
|
size = { 14 }
|
|
|
|
src = { IconArrowDown } />
|
|
|
|
</div>
|
|
|
|
}
|
2020-04-16 10:47:10 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ActionButton;
|