You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
899 B

2 years ago
  1. "use strict";
  2. const React = require("react");
  3. const Layout = require("./layout");
  4. function Room({ room }) {
  5. return (
  6. <div className="room">
  7. <div className="name">{room.name}</div>
  8. <div className="userCount">{room.num_joined_members} users</div>
  9. <div className="alias">{room.canonical_alias}</div>
  10. <div className="topic">{room.topic}</div>
  11. </div>
  12. );
  13. }
  14. module.exports = function Rooms({ rooms, nextBatchUrl, previousBatchUrl }) {
  15. return (
  16. <Layout>
  17. <div className="navigation">
  18. {(previousBatchUrl != null)
  19. ? <a href={previousBatchUrl}>&lt;&lt; Previous</a>
  20. : null
  21. }
  22. {(previousBatchUrl != null && nextBatchUrl != null)
  23. ? " | "
  24. : null
  25. }
  26. {(nextBatchUrl != null)
  27. ? <a href={nextBatchUrl}>Next &gt;&gt;</a>
  28. : null
  29. }
  30. </div>
  31. {rooms.map((room) => {
  32. return <Room key={room.id} room={room} />;
  33. })}
  34. </Layout>
  35. );
  36. };