forked from openedx/frontend-app-admin-console
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAuthZTitle.tsx
More file actions
52 lines (47 loc) · 1.32 KB
/
AuthZTitle.tsx
File metadata and controls
52 lines (47 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { ReactNode } from 'react';
import { Link } from 'react-router-dom';
import {
Breadcrumb, Col, Container, Row, Button, Badge,
} from '@openedx/paragon';
interface BreadcrumbLink {
label: string;
to?: string;
}
interface Action {
label: string;
onClick: () => void;
}
export interface AuthZTitleProps {
activeLabel: string;
pageTitle: string;
pageSubtitle: string | ReactNode;
navLinks?: BreadcrumbLink[];
actions?: Action[];
}
const AuthZTitle = ({
activeLabel, navLinks = [], pageTitle, pageSubtitle, actions = [],
}: AuthZTitleProps) => (
<Container className="p-5 bg-light-100">
<Breadcrumb
linkAs={Link}
links={navLinks}
activeLabel={activeLabel}
/>
<Row className="mt-4">
<Col xs={12} md={8} className="mb-4">
<h1 className="text-primary">{pageTitle}</h1>
{typeof pageSubtitle === 'string'
? <h3><Badge className="py-2 px-3 font-weight-normal" variant="light">{pageSubtitle}</Badge></h3>
: pageSubtitle}
</Col>
<Col xs={12} md={4}>
<div className="d-flex justify-content-md-end">
{
actions.map(({ label, onClick }) => <Button key={`authz-header-action-${label}`} onClick={onClick}>{label}</Button>)
}
</div>
</Col>
</Row>
</Container>
);
export default AuthZTitle;