Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/authz-module/components/AddRoleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const AddRoleButton = ({ presetUsername, from }: AddRoleButtonProps) => {
return (
canAssignRole ? (
<Button
size="sm"
iconBefore={Plus}
onClick={handleClick}
>
Expand Down
7 changes: 7 additions & 0 deletions src/authz-module/components/AuthZTitle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ describe('AuthZTitle', () => {
expect(screen.getByText(defaultProps.activeLabel)).toBeInTheDocument();
});

it('does not render the breadcrumb when there is no activeLabel and no navLinks', () => {
render(<AuthZTitle pageTitle="Page Title" />);

expect(screen.queryByRole('navigation')).not.toBeInTheDocument();
expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent('Page Title');
});

it('renders page title', () => {
render(<AuthZTitle {...defaultProps} />);
expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent(defaultProps.pageTitle);
Expand Down
27 changes: 16 additions & 11 deletions src/authz-module/components/AuthZTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface AuthZTitleProps {

export const ActionButton = ({ label, icon, onClick }: Action) => (
<Button
size="sm"
iconBefore={icon}
onClick={onClick}
>
Expand All @@ -40,23 +41,27 @@ export const ActionButton = ({ label, icon, onClick }: Action) => (
const AuthZTitle = ({
activeLabel, navLinks = [], pageTitle, pageSubtitle, actions = [],
}: AuthZTitleProps) => {
const shouldRenderBreadcrumb = activeLabel || navLinks?.length > 0;
const isDesktop = useMediaQuery({ minWidth: breakpoints.large.minWidth });
return (
<div className="page-band py-5 bg-light-100">
<Breadcrumb
linkAs={Link}
links={navLinks}
activeLabel={activeLabel}
/>
<Row className="mt-4">
<Col xs={12} md={7} className="mb-4">
<div className="d-flex align-items-center flex-column-sm">
<div className="page-band py-4 bg-light-100">
{ shouldRenderBreadcrumb
&& (
<Breadcrumb
linkAs={Link}
links={navLinks}
activeLabel={activeLabel}
/>
)}
<Row>
<Col xs={12} md={7}>
<div className="d-flex align-items-center flex-column-sm mb-3 mb-md-0">
<h2 className="text-primary mb-0">{pageTitle}</h2>
{pageSubtitle && (
<>
<hr className="authz-action-divider mx-lg-3" />
<hr className="authz-action-divider mx-lg-3 my-md-0 mx-md-3" />
{typeof pageSubtitle === 'string'
? <h3 className="mb-0 py-2 font-weight-light text-gray-700">{pageSubtitle}</h3>
? <h3 className="mb-0 font-weight-light text-gray-700">{pageSubtitle}</h3>
: <div className="mb-0">{pageSubtitle}</div>}
</>
)}
Expand Down
7 changes: 6 additions & 1 deletion src/authz-module/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

.authz-action-divider {
border-right: var(--pgn-size-border-width) solid var(--pgn-color-border);
height: var(--height-action-divider);
width: 0;
}

Expand Down Expand Up @@ -84,6 +83,12 @@
width: 100%;
}
}

@media (--pgn-size-breakpoint-min-width-md) {
.authz-action-divider {
height: var(--height-action-divider);
}
}
}

.highlighted-users-input {
Expand Down
Loading