Details.tsx 2.2 KB

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