From cf7b659c12835f6e6920817b2fbc2dbb41e54240 Mon Sep 17 00:00:00 2001 From: neha Date: Tue, 9 Aug 2022 17:56:07 +0100 Subject: [PATCH 01/21] Layout component added --- ui/src/App.js | 11 ++++------- ui/src/Components/Header/Header.js | 6 +++--- ui/src/Components/Layout/Layout.js | 18 ++++++++++++++++++ ui/src/Components/LeftNav/LeftNav.js | 22 ++++++++++++++++++++++ ui/src/Constant/constant.js | 8 ++++++++ 5 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 ui/src/Components/Layout/Layout.js create mode 100644 ui/src/Components/LeftNav/LeftNav.js diff --git a/ui/src/App.js b/ui/src/App.js index f27d3bf..206ff8b 100644 --- a/ui/src/App.js +++ b/ui/src/App.js @@ -1,18 +1,15 @@ import Dashboard from "./Components/Dashboard/Dashboard"; -import Footer from "./Components/Footer/Footer"; +import Layout from "./Components/Layout/Layout"; import { FEATURE_FLAGS, FEATURE_FLAGS_HEADERS} from "./Mock/featureFlags"; function App() { return ( -
- + -
-
+ ); } diff --git a/ui/src/Components/Header/Header.js b/ui/src/Components/Header/Header.js index 1bccf30..b3b9378 100644 --- a/ui/src/Components/Header/Header.js +++ b/ui/src/Components/Header/Header.js @@ -6,12 +6,12 @@ export default function Header({ user }) {
- + /> */}

- {user.github_display_name} + name

+
+
+ +
+

+ Docs +

+
+
+ + +`; diff --git a/ui/src/test/__snapshots__/Sdk.test.js.snap b/ui/src/test/__snapshots__/Sdk.test.js.snap new file mode 100644 index 0000000..c202203 --- /dev/null +++ b/ui/src/test/__snapshots__/Sdk.test.js.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` component snapshpt should match 1`] = ` +
+
+ +

+ Pallab Sonowal +

+ +
+
+ +
+

+ Sdk +

+
+
+ +
+`; From 1326d0ca835dbe4ab2c702c2c9c1a958ab8e85ea Mon Sep 17 00:00:00 2001 From: neha Date: Sun, 14 Aug 2022 16:48:31 +0100 Subject: [PATCH 10/21] Optimized LeftNav component & added Flag page --- ui/src/Components/LeftNav/LeftNav.js | 28 ++++++---------------------- ui/src/Constant/constant.js | 10 +++++----- ui/src/Pages/Flags/Flags.js | 9 +++++++++ ui/src/Routes/Route.js | 6 ++++-- 4 files changed, 24 insertions(+), 29 deletions(-) create mode 100644 ui/src/Pages/Flags/Flags.js diff --git a/ui/src/Components/LeftNav/LeftNav.js b/ui/src/Components/LeftNav/LeftNav.js index 35867a0..c895528 100644 --- a/ui/src/Components/LeftNav/LeftNav.js +++ b/ui/src/Components/LeftNav/LeftNav.js @@ -1,33 +1,17 @@ import { Link } from "react-router-dom"; -import { NAV, PATH } from '../../Constant/constant'; +import { NAV } from '../../Constant/constant'; export default function LeftNav(){ - const LEFTNAV = { - 'name': 'value' - } const createNavigation = () => { - for(let i in LEFTNAV){ - return
  • - {NAV.FLAGS} -
  • - } + return Object.keys(NAV).map(function(key){ + return
  • + {key}
  • + }) } return( ) diff --git a/ui/src/Constant/constant.js b/ui/src/Constant/constant.js index b385bf8..2c7816b 100644 --- a/ui/src/Constant/constant.js +++ b/ui/src/Constant/constant.js @@ -5,11 +5,11 @@ export const FOOTER = { } export const NAV = { - "HOME" : "Home", - "CREATE_USERS" : "Create Users", - "FLAGS" : "Dashboard", - "SDK" : "SDK", - "DOCS" : "Docs", + "Home" : "/", + "Create Users" : "/users", + "Flags" : "/flags", + "SDK" : "/sdk", + "Docs" : "/docs", } export const PATH = { diff --git a/ui/src/Pages/Flags/Flags.js b/ui/src/Pages/Flags/Flags.js new file mode 100644 index 0000000..90d6d33 --- /dev/null +++ b/ui/src/Pages/Flags/Flags.js @@ -0,0 +1,9 @@ +import Layout from "../../Components/Layout/Layout"; + +export default function Flags(){ + return( + +

    Flags

    +
    + ) +} \ No newline at end of file diff --git a/ui/src/Routes/Route.js b/ui/src/Routes/Route.js index 13db8e1..7aeb582 100644 --- a/ui/src/Routes/Route.js +++ b/ui/src/Routes/Route.js @@ -1,18 +1,20 @@ import { BrowserRouter, Routes, Route } from "react-router-dom"; import { PATH } from "../Constant/constant"; +import Home from '../Pages/Home/Home'; import Docs from '../Pages/Docs/Docs'; import Sdk from '../Pages/Sdk/Sdk'; import Users from '../Pages/Users/Users'; -import Home from '../Pages/Home/Home'; +import Flags from '../Pages/Flags/Flags'; import NotFound from '../Pages/NotFound/NotFound'; export default function RootRoute(){ return( - } /> + } /> } /> } /> + } /> } /> } /> From 22c9df399715c666eeea75ef94e193ef2af36d10 Mon Sep 17 00:00:00 2001 From: neha Date: Sun, 14 Aug 2022 18:38:35 +0100 Subject: [PATCH 11/21] Test-cases updated --- ui/src/Components/Layout/Layout.js | 6 +-- ui/src/test/Docs.test.js | 7 +-- ui/src/test/Home.test.js | 4 +- ui/src/test/Layout.test.js | 6 ++- ui/src/test/LeftNav.test.js | 3 +- ui/src/test/Sdk.test.js | 8 +-- ui/src/test/__snapshots__/Docs.test.js.snap | 55 ++++++++++++++++++++- ui/src/test/__snapshots__/Sdk.test.js.snap | 55 ++++++++++++++++++++- 8 files changed, 127 insertions(+), 17 deletions(-) diff --git a/ui/src/Components/Layout/Layout.js b/ui/src/Components/Layout/Layout.js index 6e9d055..03dda78 100644 --- a/ui/src/Components/Layout/Layout.js +++ b/ui/src/Components/Layout/Layout.js @@ -6,14 +6,14 @@ import { USER } from '../../test/Fixtures/user'; export default function Layout(props){ return( <> -
    +
    - +
    {props.children}
    -