Skip to content

Commit

Permalink
Merge branch 'main' into UTOPIA-1286
Browse files Browse the repository at this point in the history
  • Loading branch information
binggaofw authored Jul 17, 2023
2 parents 5754c1e + d087c8c commit adeb210
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/frontend/src/components/public/PIANavButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useLocation, useNavigate } from 'react-router-dom';
import { INavButton } from './interface';
import HandleState from './handleState';
import { roleCheck } from '../../../utils/helper.util';

const PIANavButton = ({ pages }: INavButton) => {
const PIANavButton = ({ pages, isDelegate }: INavButton) => {
const { pathname } = useLocation();
const navigate = useNavigate();

Expand Down Expand Up @@ -30,6 +31,8 @@ const PIANavButton = ({ pages }: INavButton) => {
}
};

const userRole = roleCheck().roles;

return (
<>
{(HandleState(pages, pathname, 'prev') ||
Expand All @@ -49,18 +52,19 @@ const PIANavButton = ({ pages }: INavButton) => {
: 'Back'}
</button>
)}
{HandleState(pages, pathname, 'next') && (
<button
className="bcgovbtn bcgovbtn__secondary btn-next ms-auto"
onClick={handleNext}
type="button"
aria-label="Next Button"
>
{typeof HandleState(pages, pathname, 'next') === 'object'
? Object(HandleState(pages, pathname, 'next'))?.title
: 'Next'}
</button>
)}
{HandleState(pages, pathname, 'next') &&
(!isDelegate || userRole !== undefined) && (
<button
className="bcgovbtn bcgovbtn__secondary btn-next ms-auto"
onClick={handleNext}
type="button"
aria-label="Next Button"
>
{typeof HandleState(pages, pathname, 'next') === 'object'
? Object(HandleState(pages, pathname, 'next'))?.title
: 'Next'}
</button>
)}
</div>
</>
);
Expand Down

0 comments on commit adeb210

Please sign in to comment.