import React from 'react'; import { useDispatch, useSelector, shallowEqual } from 'react-redux'; import { withRedux } from 'lib/redux'; import Card from 'components/card'; import AddCard from 'components/addCard'; const column = ({ name, id, headerColor }) => { const dispatch = useDispatch(); const cards = useSelector(state => state.cards.filter( c => (c.column === id) ), shallowEqual); const colIds = useSelector(state => state.columns.map(c => c.id)); const myIndex = colIds.findIndex(x => x === id); const neighbors = [null, ...colIds, null]; const prevColId = neighbors[myIndex+1-1]; const nextColId = neighbors[myIndex+1+1]; const moverFactory = (id, column) => { if (column) { return () => { dispatch({ type: 'MOVE_CARD', payload: { id, column } }); } } else { return null; } } return

{name}

{ cards.map(({ text, id }) => ) }
} export default withRedux(column);