-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create validation sets app shell (#4803)
* feat: Create view for validation sets * feat: Create container for validation sets
- Loading branch information
Showing
11 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createRoot } from "react-dom/client"; | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom"; | ||
|
||
import Root from "./routes/root"; | ||
import ValidationSets from "./pages/ValidationSets"; | ||
import ValidationSet from "./pages/ValidationSet"; | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Root />, | ||
children: [ | ||
{ | ||
path: "/validation-sets", | ||
element: <ValidationSets />, | ||
}, | ||
{ | ||
path: "/validation-sets/:validationSetId", | ||
element: <ValidationSet />, | ||
}, | ||
], | ||
}, | ||
]); | ||
|
||
const rootEl = document.getElementById("root") as HTMLElement; | ||
const root = createRoot(rootEl); | ||
|
||
root.render(<RouterProvider router={router} />); |
9 changes: 9 additions & 0 deletions
9
static/js/validation-sets/pages/ValidationSet/ValidationSet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function ValidationSet(): JSX.Element { | ||
return ( | ||
<> | ||
<h1>Validation set page</h1> | ||
</> | ||
); | ||
} | ||
|
||
export default ValidationSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./ValidationSet"; |
9 changes: 9 additions & 0 deletions
9
static/js/validation-sets/pages/ValidationSets/ValidationSets.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function ValidationSets(): JSX.Element { | ||
return ( | ||
<> | ||
<h1>Validation sets page</h1> | ||
</> | ||
); | ||
} | ||
|
||
export default ValidationSets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./ValidationSets"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { useState } from "react"; | ||
import { Outlet } from "react-router-dom"; | ||
|
||
import { | ||
ApplicationLayout, | ||
Panel, | ||
Row, | ||
Col, | ||
} from "@canonical/react-components"; | ||
|
||
function Root(): JSX.Element { | ||
const [menuPinned, setMenuPinned] = useState<boolean>(false); | ||
const [menuCollapsed, setMenuCollapsed] = useState<boolean>(false); | ||
|
||
return ( | ||
<ApplicationLayout | ||
menuPinned={menuPinned} | ||
onPinMenu={setMenuPinned} | ||
menuCollapsed={menuCollapsed} | ||
onCollapseMenu={setMenuCollapsed} | ||
logo={{ | ||
icon: "https://assets.ubuntu.com/v1/dae35907-Snapcraft%20tag.svg", | ||
name: "https://assets.ubuntu.com/v1/6cd1a881-snapcraft_logo_white.svg", | ||
nameAlt: "Snapcraft", | ||
href: "/", | ||
}} | ||
navItems={[ | ||
{ | ||
items: [ | ||
{ | ||
label: "My snaps", | ||
href: "/snaps", | ||
icon: "pods", | ||
}, | ||
{ | ||
label: "My validation sets", | ||
href: "/validation-sets", | ||
icon: "pods", | ||
}, | ||
], | ||
}, | ||
{ | ||
style: { | ||
bottom: 0, | ||
position: "absolute", | ||
width: "100%", | ||
}, | ||
items: [ | ||
{ | ||
label: "My account", | ||
href: "/admin/account", | ||
icon: "user", | ||
}, | ||
{ | ||
label: "Logout", | ||
href: "/logout", | ||
icon: "begin-downloading", | ||
}, | ||
], | ||
}, | ||
]} | ||
> | ||
<Panel> | ||
<Row> | ||
<Col size={12}> | ||
<Outlet /> | ||
</Col> | ||
</Row> | ||
</Panel> | ||
</ApplicationLayout> | ||
); | ||
} | ||
|
||
export default Root; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% set show_header = False %} | ||
{% extends "_base-layout.html" %} | ||
{% block content %} | ||
<div id="root"> | ||
</div> | ||
<script src="{{ static_url('js/dist/validation-sets.js') }}"></script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters