12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // @flow
-
- import React from 'react';
-
- import { Icon, IconArrowDown } from '../../../icons';
-
- type Props = {
-
- /**
- * Text of the button.
- */
- children: React$Node,
-
- /**
- * Text css class of the button.
- */
- className?: string,
-
- /**
- * If the button is disabled or not.
- */
- disabled?: boolean,
-
- /**
- * If the button has options.
- */
- hasOptions?: boolean,
-
- /**
- * TestId of the button. Can be used to locate element when testing UI.
- */
- testId?: string,
-
- /**
- * The type of th button: primary, secondary, text.
- */
- type: string,
-
- /**
- * OnClick button handler.
- */
- onClick: Function,
-
- /**
- * Click handler for options.
- */
- onOptionsClick?: Function
- };
-
- /**
- * Button used for pre meeting actions.
- *
- * @returns {ReactElement}
- */
- function ActionButton({
- children,
- className = '',
- disabled,
- hasOptions,
- testId,
- type = 'primary',
- onClick,
- onOptionsClick
- }: Props) {
- return (
- <div
- className = { `action-btn ${className} ${type} ${disabled ? 'disabled' : ''}` }
- data-testid = { testId ? testId : undefined }
- onClick = { disabled ? undefined : onClick }>
- {children}
- {hasOptions && <div
- className = 'options'
- data-testid = 'prejoin.joinOptions'
- onClick = { disabled ? undefined : onOptionsClick }>
- <Icon
- className = 'icon'
- size = { 14 }
- src = { IconArrowDown } />
- </div>
- }
- </div>
- );
- }
-
- export default ActionButton;
|