import * as React from 'react'
import * as ReactDOM from 'react-dom'

interface IntegrationsProps {
  path?: string
}

class Integrations extends React.Component<IntegrationsProps> {
  private ref = React.createRef()

  componentDidMount () {
    window.xkit.renderCatalog(this.ref.current, {
      hideTitle: true,
      hideSearch: true,
      rootPath: this.props.path
    })
  }

  componentWillUnmount () {
    window.xkit.unmountCatalog(this.ref.current)
  }

  render () {
    return <div ref={this.ref}></div>
  }
}

export default Integrations