forked from openedx/frontend-app-admin-console
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddRoleButton.tsx
More file actions
34 lines (28 loc) · 889 Bytes
/
AddRoleButton.tsx
File metadata and controls
34 lines (28 loc) · 889 Bytes
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
import React from 'react';
import { useIntl } from '@edx/frontend-platform/i18n';
import { Button } from '@openedx/paragon';
import { Plus } from '@openedx/paragon/icons';
import { useNavigate } from 'react-router-dom';
import baseMessages from '@src/authz-module/messages';
import { buildWizardPath } from '@src/authz-module/constants';
interface AddRoleButtonProps {
presetUsername?: string;
from?: string;
}
const AddRoleButton = ({ presetUsername, from }: AddRoleButtonProps) => {
const intl = useIntl();
const navigate = useNavigate();
const handleClick = () => {
const path = buildWizardPath({ from, users: presetUsername });
navigate(path);
};
return (
<Button
iconBefore={Plus}
onClick={handleClick}
>
{intl.formatMessage(baseMessages['authz.management.assign.role.title'])}
</Button>
);
};
export default AddRoleButton;