
import Cell from './Cell'
import './index.scss'

export default function(props) {
  const dataset = props.dataset || []
  const disable = props.disable

  const handleActionClick = (item) => {
    if (item.action && props.onActionClick) {
      props.onActionClick(item)
    }
  }

  return (
    <View className="cell-block">
      {
        dataset.map((item, inx) => (
          <View key={`cell-${inx}`} className="cell-block-item">
            <Cell
              disable={disable}
              head={item.head}
              body={item.body}
              action={item.action}
              hide={item.hide}
              desc={item.desc}
              onActionClick={handleActionClick.bind(this, item)}
              />
          </View>
        ))
      }
    </View>
  )
}
