NotAvailableForGuest.jsx 827 B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { UncontrolledTooltip } from 'reactstrap';
  4. const NotAvailableForGuest = ({ children }) => {
  5. const id = `not-available-for-guest-${Math.random().toString(32).substring(2)}`;
  6. // clone and add className
  7. const clonedChildren = React.Children.map(children, child => (
  8. React.cloneElement(child, {
  9. id,
  10. className: `${child.props.className} grw-not-available-for-guest`,
  11. onClick: () => { /* do nothing */ },
  12. })
  13. ));
  14. return (
  15. <>
  16. { clonedChildren }
  17. {/* <UncontrolledTooltip placement="bottom" fade={false} target={id}>Not available for guest</UncontrolledTooltip> */}
  18. </>
  19. );
  20. };
  21. NotAvailableForGuest.propTypes = {
  22. children: PropTypes.array.length(1).isRequired,
  23. };
  24. export default NotAvailableForGuest;