12345678910111213141516171819202122232425262728293031
  1. import React, { useState } from 'react'
  2. import { getImgURL } from '@/utils/image'
  3. import Preview from './Preview'
  4. import Form from './Form'
  5. import Styles from './style.less'
  6. const noop = x => x;
  7. export default (props) => {
  8. const { target, rights, onCancel = noop } = props
  9. const { id: targetId, type: targetType } = target
  10. const [posterImg, setPosterImg] = useState()
  11. return (
  12. <div className={Styles['building-poster']}>
  13. <div className={Styles['poster-preview']}>
  14. <Preview img={getImgURL(posterImg)} />
  15. </div>
  16. <div className={Styles['poster-form']}>
  17. <Form
  18. targetId={targetId}
  19. targetType={targetType}
  20. rights={rights}
  21. onImageChange={setPosterImg}
  22. onCancel={onCancel}
  23. />
  24. </div>
  25. </div>
  26. )
  27. }