generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ORV2-1433 adding a sticky navigation button bar for IDIR users (#672)
- Loading branch information
Showing
15 changed files
with
132 additions
and
10 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
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
7 changes: 7 additions & 0 deletions
7
frontend/src/common/components/naviconsidebar/NavIconHomeButton.scss
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 @@ | ||
@use "../../../themes/orbcStyles"; | ||
|
||
.nav-icon-home-button-container { | ||
border: 1px solid #003366; | ||
background-color: #003366; | ||
width: 45px; | ||
} |
27 changes: 27 additions & 0 deletions
27
frontend/src/common/components/naviconsidebar/NavIconHomeButton.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,27 @@ | ||
import './NavIconHomeButton.scss' | ||
import { IconButton, Tooltip } from "@mui/material"; | ||
import { Home } from "@mui/icons-material"; | ||
import { useNavigate } from "react-router-dom"; | ||
import * as routes from "../../../routes/constants"; | ||
|
||
/** | ||
* Displays the navigation icon for Home on the NavIconSideBar | ||
*/ | ||
export const NavIconHomeButton = () => { | ||
|
||
const navigate = useNavigate() | ||
|
||
return ( | ||
<div className="nav-icon-home-button-container"> | ||
<Tooltip arrow placement="left" title="Home"> | ||
<IconButton | ||
size="medium" | ||
color="secondary" | ||
onClick={() => {navigate(routes.IDIR_WELCOME)}} | ||
> | ||
<Home /> | ||
</IconButton> | ||
</Tooltip> | ||
</div> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
frontend/src/common/components/naviconsidebar/NavIconReportButton.scss
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 @@ | ||
@use "../../../themes/orbcStyles"; | ||
|
||
.nav-icon-report-button-container { | ||
border: 1px solid #003366; | ||
background-color: #003366; | ||
width: 45px; | ||
} |
27 changes: 27 additions & 0 deletions
27
frontend/src/common/components/naviconsidebar/NavIconReportButton.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,27 @@ | ||
import './NavIconReportButton.scss' | ||
import { IconButton, Tooltip } from "@mui/material"; | ||
import { Note } from "@mui/icons-material"; | ||
import { useNavigate } from "react-router-dom"; | ||
import * as routes from "../../../routes/constants"; | ||
|
||
/** | ||
* Displays the navigation icon for Reports on the NavIconSideBar | ||
*/ | ||
export const NavIconReportButton = () => { | ||
|
||
const navigate = useNavigate() | ||
|
||
return ( | ||
<div className="nav-icon-report-button-container"> | ||
<Tooltip arrow placement="left" title="Reports"> | ||
<IconButton | ||
size="medium" | ||
color="secondary" | ||
onClick={() => {navigate(routes.IDIR_WELCOME)}} | ||
> | ||
<Note /> | ||
</IconButton> | ||
</Tooltip> | ||
</div> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
frontend/src/common/components/naviconsidebar/NavIconSideBar.scss
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,8 @@ | ||
@use "../../../themes/orbcStyles"; | ||
|
||
.nav-icon-side-bar { | ||
position: -webkit-sticky; /* Safari */ | ||
position: sticky; | ||
left: 0; | ||
top: 400px; | ||
} |
26 changes: 26 additions & 0 deletions
26
frontend/src/common/components/naviconsidebar/NavIconSideBar.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,26 @@ | ||
|
||
import {IDPS} from '../../types/idp' | ||
import './NavIconSideBar.scss' | ||
import { useAuth } from 'react-oidc-context' | ||
|
||
interface NavIconSideBarProps { | ||
children?: React.ReactNode; | ||
} | ||
|
||
/** | ||
* Displays a sidebar with NavIcon buttons as children | ||
*/ | ||
export const NavIconSideBar = (props: NavIconSideBarProps) => { | ||
const { children } = props; | ||
const { user } = useAuth() | ||
const isIdir = user?.profile?.identity_provider === IDPS.IDIR | ||
|
||
return ( | ||
<div className="nav-icon-side-bar"> | ||
{isIdir && children} | ||
</div> | ||
) | ||
} | ||
|
||
|
||
|
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,6 @@ | ||
export const IDPS = { | ||
BCEID: 'bceidboth', | ||
IDIR: 'idir' | ||
} as const | ||
|
||
export type IDP = typeof IDPS[keyof typeof IDPS] |
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
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