import { closeModal, openModal } from '../components/modal'
import { AppSelector } from '../components/AppSelector'

let renderFn: () => void

export function openAppSelectorModal(render: () => void) {
  renderFn = render

  openModal('Select App', () => (
    <AppSelector
      render={renderFn}
      onSelect={closeModal}
      switcherStyle={{ padding: '0 0 12px', marginLeft: -20, marginRight: -20, paddingLeft: 20, paddingRight: 20, marginBottom: 8 }}
      listStyle={{ maxHeight: 300, overflow: 'auto' }}
    />
  ))
}
