Skip to content

Commit

Permalink
add titles
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay288 committed Aug 14, 2022
1 parent b5f8cc9 commit 254e582
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
9 changes: 8 additions & 1 deletion frontend/src/components/SidebarLayoutShell.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import React from "react";
import Head from "next/head";
import { Box, HStack } from "@chakra-ui/react";
import SideNavBar from "./Sidebar";
import { SideNavLinkDestination } from "components/Sidebar/NavLinkUtils";
import { DarkModeSwitch } from "components/utils/DarkModeSwitch";

interface SidebarLayoutShellProps {
title?: string;
currentTab?: SideNavLinkDestination;
children?: React.ReactNode;
}

export const SidebarLayoutShell: React.FC<SidebarLayoutShellProps> = React.memo(
({ currentTab, children }) => {
({ title, currentTab, children }) => {
return (
<HStack spacing={0}>
{title ? (
<Head>
<title>{title}</title>
</Head>
) : null}
<SideNavBar currentTab={currentTab} />
<Box h="100vh" flex="1" overflowY="auto">
{children}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/alerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const Alerts = () => {
fetchAlerts();
}, [params]);
return (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Alerts}>
<SidebarLayoutShell
title="Alerts"
currentTab={SideNavLinkDestination.Alerts}
>
<ContentContainer>
<VStack w="full" alignItems="flex-start">
<Heading fontWeight="medium" size="xl" mb="8">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { testConnections } from "testData";
import { Connection } from "@common/types";

const Connections = ({ connections }) => (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Connections}>
<SidebarLayoutShell title="Connections" currentTab={SideNavLinkDestination.Connections}>
<ContentContainer>
<VStack w="full" alignItems="flex-start">
<Heading fontWeight="medium" size="xl" mb="8">
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/endpoint/[endpointUUID].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const Endpoint = ({ endpoint, usage }) => {
return <ErrorPage statusCode={404} />;
}
return (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Endpoints}>
<SidebarLayoutShell
title="Endpoint"
currentTab={SideNavLinkDestination.Endpoints}
>
<EndpointPage endpoint={parsedEndpoint} usage={parsedUsage} />
</SidebarLayoutShell>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Endpoints = () => {
fetchEndpoints();
}, [params]);
return (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Endpoints}>
<SidebarLayoutShell title="Endpoints" currentTab={SideNavLinkDestination.Endpoints}>
<ContentContainer>
<VStack w="full" alignItems="flex-start">
<Heading fontWeight="medium" size="xl" mb="8">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Index = ({ summary, topAlerts }) => {
const parsedSummary = superjson.parse<Summary>(summary);
const parsedTopAlerts = superjson.parse<Alert[]>(topAlerts);
return (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Home}>
<SidebarLayoutShell title="Home" currentTab={SideNavLinkDestination.Home}>
<ContentContainer>
<VStack w="full" alignItems="flex-start">
<Heading fontWeight="medium" size="xl" mb="8">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/specs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { OpenApiSpec } from "@common/types";
import { getSpecs } from "api/apiSpecs";

const Specs = ({ apiSpecs }) => (
<SidebarLayoutShell currentTab={SideNavLinkDestination.Specs}>
<SidebarLayoutShell title="API Specs" currentTab={SideNavLinkDestination.Specs}>
<ContentContainer>
<VStack w="full" alignItems="flex-start">
<Heading fontWeight="medium" size="xl" mb="8">
Expand Down

0 comments on commit 254e582

Please sign in to comment.