/**
 * UserCreateDialog component
 */
'use strict'

import React from 'react'
import { TheDialog, TheInfo, TheOkDialog } from 'the-components'

function TheCreateDialog({
  active,
  children,
  done,
  doneTitle = title,
  full,
  l,
  onClose,
  result,
  spinning,
  title,
}) {
  if (!active) {
    return null
  }
  if (done) {
    return (
      <TheOkDialog
        hideCloseButton
        present
        title={doneTitle}
        {...{ full, onClose, spinning }}
      >
        <TheInfo data={result} />
      </TheOkDialog>
    )
  }
  return (
    <TheDialog present {...{ full, onClose, spinning, title }}>
      {children}
    </TheDialog>
  )
}

export default TheCreateDialog
