import { Block } from "@tarojs/components"
import Unit from './Unit'

export default (props) => {
  const unitList = (props.dataset || {}).unitList || []
  const handleRoomClick = props.onRoomClick || (() => {})
  const handleActionClick = props.onActionClick || (() => {})

  return (
    <Block>
      {
        unitList.map((unit) => (
          <Unit
            key={unit.unitId}
            dataset={unit}
            showDataType={props.showDataType}
            onRoomClick={handleRoomClick}
            chooseList={props.chooseList}
            showAction={props.showAction}
            onActionClick={handleActionClick}
          />
        ))
      }
    </Block>
  )
}
