import sortBy from "../../../../utils/sorting/sortBy.js";
import CommaAnd from "../../../typography/CommaAnd/index.js";
import StateName from "../../StateName/index.js";
import classes from './styles.module.scss';
const ClosedDetailedText = function ClosedDetailedText(props) {
  const {
    partiallyClosed,
    pastEvent
  } = props;
  const sortedPartiallyClosed = sortBy(partiallyClosed);
  const closedOrClosingInText = pastEvent ? 'closed in' : 'closing in';
  return <div>
      {sortedPartiallyClosed.length > 0 && <p className={classes.closedDetailedText}>
          Only some polls
          {' '}
          {closedOrClosingInText}
          {' '}
          <CommaAnd items={sortedPartiallyClosed.map(state => <span key={state}>
                <StateName format="abbr" stateFips={state} />
              </span>)} />
        </p>}
    </div>;
};
export default ClosedDetailedText;