You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ActionButton.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // @flow
  2. import React from 'react';
  3. import { Icon, IconArrowDown } from '../../../base/icons';
  4. const classNameByType = {
  5. primary: 'prejoin-btn--primary',
  6. secondary: 'prejoin-btn--secondary',
  7. text: 'prejoin-btn--text'
  8. };
  9. type Props = {
  10. /**
  11. * Text of the button.
  12. */
  13. children: React$Node,
  14. /**
  15. * Text css class of the button.
  16. */
  17. className?: string,
  18. /**
  19. * If the button has options.
  20. */
  21. hasOptions?: boolean,
  22. /**
  23. * The type of th button: primary, secondary, text.
  24. */
  25. type: string,
  26. /**
  27. * OnClick button handler.
  28. */
  29. onClick: Function,
  30. /**
  31. * Click handler for options.
  32. */
  33. onOptionsClick?: Function
  34. };
  35. /**
  36. * Button used for prejoin actions: Join/Join without audio/Join by phone.
  37. *
  38. * @returns {ReactElement}
  39. */
  40. function ActionButton({ children, className, hasOptions, type, onClick, onOptionsClick }: Props) {
  41. const ownClassName = `prejoin-btn ${classNameByType[type]}`;
  42. const cls = className ? `${className} ${ownClassName}` : ownClassName;
  43. return (
  44. <div
  45. className = { cls }
  46. onClick = { onClick }>
  47. {children}
  48. {hasOptions && <div
  49. className = 'prejoin-btn-options'
  50. onClick = { onOptionsClick }>
  51. <Icon
  52. className = 'prejoin-btn-icon'
  53. size = { 14 }
  54. src = { IconArrowDown } />
  55. </div>
  56. }
  57. </div>
  58. );
  59. }
  60. export default ActionButton;