import { getStateName } from "../../../../utils/election/index.js";
import { intcomma } from 'journalize';
import cx from "../../../../utils/css/cx.js";
import classes from './styles.module.scss';
const cls = cx.merge(classes);
export default function StateTable({
  states
}) {
  return <table className={cls('cand-table')}>
      <thead>
        <tr>
          <th>State</th>
          <th>Del. won</th>
        </tr>
      </thead>
      <tbody>
        {states.map(({
        stateFips,
        total
      }) => <tr key={stateFips}>
              <td className={cls('state-cell')}>{getStateName(stateFips)}</td>
              <td className={cls('del-cell')}>{intcomma(total)}</td>
            </tr>)}
      </tbody>
    </table>;
}