ThreadsCategoryPicker.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React from "react"
  2. import { Link } from "react-router"
  3. const ThreadsCategoryPicker = ({
  4. allItems,
  5. parentUrl,
  6. category,
  7. categories,
  8. list,
  9. }) => (
  10. <div className="dropdown threads-category-picker">
  11. <button
  12. type="button"
  13. className="btn btn-default btn-outline dropdown-toggle btn-block text-ellipsis"
  14. data-toggle="dropdown"
  15. aria-haspopup="true"
  16. aria-expanded="false"
  17. >
  18. {category && (
  19. <span
  20. className="material-icon"
  21. style={{ color: category.color || "inherit" }}
  22. >
  23. label
  24. </span>
  25. )}
  26. {category && category.short_name && (
  27. <span className={category.short_name && "hidden-md hidden-lg"}>
  28. {category.short_name}
  29. </span>
  30. )}
  31. {category ? (
  32. <span className={category.short_name && "hidden-xs hidden-sm"}>
  33. {category.name}
  34. </span>
  35. ) : (
  36. allItems
  37. )}
  38. </button>
  39. <ul className="dropdown-menu">
  40. <li>
  41. <Link to={parentUrl + list.path}>{allItems}</Link>
  42. </li>
  43. <li role="separator" className="divider" />
  44. {categories.map((choice) => (
  45. <li key={choice.id}>
  46. <Link to={choice.url.index + list.path}>
  47. <span
  48. className="material-icon"
  49. style={{ color: choice.color || "inherit" }}
  50. >
  51. label
  52. </span>
  53. {choice.name}
  54. </Link>
  55. </li>
  56. ))}
  57. </ul>
  58. </div>
  59. )
  60. export default ThreadsCategoryPicker