|
|
@ -1,14 +1,15 @@ |
|
|
import React, { PropTypes } from "react"; |
|
|
import React, { PropTypes } from "react"; |
|
|
|
|
|
|
|
|
const Room = ({ isSelected, name, onClick }) => { |
|
|
|
|
|
let className; |
|
|
|
|
|
|
|
|
const Room = ({ isSelected, name, onClick, room }) => { |
|
|
|
|
|
const classes = ["room"]; |
|
|
if (isSelected) { |
|
|
if (isSelected) { |
|
|
className = "room room-selected"; |
|
|
|
|
|
} else { |
|
|
|
|
|
className = "room"; |
|
|
|
|
|
|
|
|
classes.push("room-selected"); |
|
|
|
|
|
} |
|
|
|
|
|
if (room.membership == "Member") { |
|
|
|
|
|
classes.push("room-joined"); |
|
|
} |
|
|
} |
|
|
return ( |
|
|
return ( |
|
|
<a className={className} onClick={onClick} href="#"> |
|
|
|
|
|
|
|
|
<a className={classes.join(" ")} onClick={onClick} href="#"> |
|
|
{name} |
|
|
{name} |
|
|
</a> |
|
|
</a> |
|
|
); |
|
|
); |
|
|
@ -17,7 +18,10 @@ const Room = ({ isSelected, name, onClick }) => { |
|
|
Room.propTypes = { |
|
|
Room.propTypes = { |
|
|
isSelected: PropTypes.bool.isRequired, |
|
|
isSelected: PropTypes.bool.isRequired, |
|
|
name: PropTypes.string.isRequired, |
|
|
name: PropTypes.string.isRequired, |
|
|
onClick: PropTypes.func.isRequired |
|
|
|
|
|
|
|
|
onClick: PropTypes.func.isRequired, |
|
|
|
|
|
room: PropTypes.shape({ |
|
|
|
|
|
membership: PropTypes.string.isRequired |
|
|
|
|
|
}) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export default Room; |
|
|
export default Room; |