Skip to content

Commit 2e0a650

Browse files
committed
Add Footer to AuthAndNav, rename
1 parent 300c6d0 commit 2e0a650

File tree

4 files changed

+35
-26
lines changed

4 files changed

+35
-26
lines changed

site/src/AppRouter.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react"
22
import { Route, Routes } from "react-router-dom"
3-
import { AuthAndNav, RequireAuth } from "./components"
3+
import { RequireAuth } from "./components"
4+
import { AuthAndFrame } from "./components/AuthAndFrame/AuthAndFrame"
45
import { PreferencesLayout } from "./components/Preferences/Layout"
56
import { IndexPage } from "./pages"
67
import { NotFoundPage } from "./pages/404"
@@ -39,18 +40,18 @@ export const AppRouter: React.FC = () => (
3940
<Route
4041
index
4142
element={
42-
<AuthAndNav>
43+
<AuthAndFrame>
4344
<TemplatesPage />
44-
</AuthAndNav>
45+
</AuthAndFrame>
4546
}
4647
/>
4748
<Route path=":organization/:template">
4849
<Route
4950
index
5051
element={
51-
<AuthAndNav>
52+
<AuthAndFrame>
5253
<TemplatePage />
53-
</AuthAndNav>
54+
</AuthAndFrame>
5455
}
5556
/>
5657
<Route
@@ -68,35 +69,35 @@ export const AppRouter: React.FC = () => (
6869
<Route
6970
path=":workspace"
7071
element={
71-
<AuthAndNav>
72+
<AuthAndFrame>
7273
<WorkspacePage />
73-
</AuthAndNav>
74+
</AuthAndFrame>
7475
}
7576
/>
7677
</Route>
7778

7879
<Route
7980
path="users"
8081
element={
81-
<AuthAndNav>
82+
<AuthAndFrame>
8283
<UsersPage />
83-
</AuthAndNav>
84+
</AuthAndFrame>
8485
}
8586
/>
8687
<Route
8788
path="orgs"
8889
element={
89-
<AuthAndNav>
90+
<AuthAndFrame>
9091
<OrganizationsPage />
91-
</AuthAndNav>
92+
</AuthAndFrame>
9293
}
9394
/>
9495
<Route
9596
path="settings"
9697
element={
97-
<AuthAndNav>
98+
<AuthAndFrame>
9899
<SettingsPage />
99-
</AuthAndNav>
100+
</AuthAndFrame>
100101
}
101102
/>
102103

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react"
2+
import { Navbar } from "../Navbar"
3+
import { Footer } from "../Page/Footer"
4+
import { RequireAuth } from "../Page/RequireAuth"
5+
6+
interface AuthAndFrameProps {
7+
children: JSX.Element
8+
}
9+
10+
/**
11+
* Wraps page in RequireAuth and renders it between Navbar and Footer
12+
*/
13+
export const AuthAndFrame: React.FC<AuthAndFrameProps> = ({ children }) => (
14+
<RequireAuth>
15+
<>
16+
<Navbar />
17+
{children}
18+
<Footer />
19+
</>
20+
</RequireAuth>
21+
)

site/src/components/Page/AuthAndNav.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

site/src/components/Page/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export * from "./AuthAndNav"
21
export * from "./Footer"
32
export * from "./RequireAuth"

0 commit comments

Comments
 (0)