read-icon.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from 'react';
  2. export default class extends React.Component {
  3. getClassName() {
  4. if (this.props.category.is_read) {
  5. return 'read-status item-read';
  6. } else {
  7. return 'read-status item-new';
  8. }
  9. }
  10. getTitle() {
  11. if (this.props.category.is_closed) {
  12. if (this.props.category.is_read) {
  13. return gettext("This category has no new posts. (closed)");
  14. } else {
  15. return gettext("This category has new posts. (closed)");
  16. }
  17. } else {
  18. if (this.props.category.is_read) {
  19. return gettext("This category has no new posts.");
  20. } else {
  21. return gettext("This category has new posts.");
  22. }
  23. }
  24. }
  25. getIcon() {
  26. if (this.props.category.is_closed) {
  27. if (this.props.category.is_read) {
  28. return 'lock_outline';
  29. } else {
  30. return 'lock';
  31. }
  32. } else {
  33. if (this.props.category.is_read) {
  34. return 'chat_bubble_outline';
  35. } else {
  36. return 'chat_bubble';
  37. }
  38. }
  39. }
  40. render() {
  41. /* jshint ignore:start */
  42. return <div className={this.getClassName()} title={this.getTitle()}>
  43. <span className="material-icon">
  44. {this.getIcon()}
  45. </span>
  46. </div>;
  47. /* jshint ignore:end */
  48. }
  49. }