SongList.jsx 639 B

123456789101112131415161718192021222324252627282930313233343536
  1. import React, { Component } from "react";
  2. import PropTypes from "prop-types";
  3. import { connect } from "react-redux";
  4. import SongItem from "./SongItem.jsx";
  5. @connect(state => ({
  6. station: {
  7. songList: state.station.info.get("songList"),
  8. },
  9. }))
  10. export default class SongList extends Component {
  11. constructor(props) {
  12. super(props);
  13. }
  14. render() {
  15. const { songList } = this.props.station;
  16. return (
  17. <ul>
  18. {
  19. songList.map((song) => {
  20. return <SongItem key={ song.get("songId") } song={ song }/>;
  21. })
  22. }
  23. {
  24. (songList.length === 0)
  25. ? <li>No songs in queue.</li>
  26. : null
  27. }
  28. </ul>
  29. );
  30. }
  31. }