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.4KB

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