Details.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import React from 'react';
  2. import { ClusterName, Topic, TopicDetails, TopicName } from 'redux/interfaces';
  3. import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
  4. import { NavLink, Switch, Route } from 'react-router-dom';
  5. import {
  6. clusterTopicsPath,
  7. clusterTopicSettingsPath,
  8. clusterTopicPath,
  9. clusterTopicMessagesPath,
  10. } from 'lib/paths';
  11. import OverviewContainer from './Overview/OverviewContainer';
  12. import MessagesContainer from './Messages/MessagesContainer';
  13. import SettingsContainer from './Settings/SettingsContainer';
  14. interface Props extends Topic, TopicDetails {
  15. clusterName: ClusterName;
  16. topicName: TopicName;
  17. }
  18. const Details: React.FC<Props> = ({ clusterName, topicName }) => {
  19. return (
  20. <div className="section">
  21. <div className="level">
  22. <div className="level-item level-left">
  23. <Breadcrumb
  24. links={[
  25. { href: clusterTopicsPath(clusterName), label: 'All Topics' },
  26. ]}
  27. >
  28. {topicName}
  29. </Breadcrumb>
  30. </div>
  31. </div>
  32. <div className="box">
  33. <nav className="navbar" role="navigation">
  34. <NavLink
  35. exact
  36. to={clusterTopicPath(clusterName, topicName)}
  37. className="navbar-item is-tab"
  38. activeClassName="is-active is-primary"
  39. >
  40. Overview
  41. </NavLink>
  42. <NavLink
  43. exact
  44. to={clusterTopicMessagesPath(clusterName, topicName)}
  45. className="navbar-item is-tab"
  46. activeClassName="is-active"
  47. >
  48. Messages
  49. </NavLink>
  50. <NavLink
  51. exact
  52. to={clusterTopicSettingsPath(clusterName, topicName)}
  53. className="navbar-item is-tab"
  54. activeClassName="is-active"
  55. >
  56. Settings
  57. </NavLink>
  58. </nav>
  59. <br />
  60. <Switch>
  61. <Route
  62. exact
  63. path="/ui/clusters/:clusterName/topics/:topicName/messages"
  64. component={MessagesContainer}
  65. />
  66. <Route
  67. exact
  68. path="/ui/clusters/:clusterName/topics/:topicName/settings"
  69. component={SettingsContainer}
  70. />
  71. <Route
  72. exact
  73. path="/ui/clusters/:clusterName/topics/:topicName"
  74. component={OverviewContainer}
  75. />
  76. </Switch>
  77. </div>
  78. </div>
  79. );
  80. };
  81. export default Details;