-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
which allows Library Admins to add Readers, Authors, and other Admin users to the list of people who can access a Library. * Readers can only see the library, but not its Team. * Authors can see the Library Team, but cannot alter it. * Admins can update the Library Team. Modal is triggered from a button on the LibraryInfo sidebar which is only accessible to users who can edit the library.
- Loading branch information
1 parent
5ec863e
commit 06fff10
Showing
14 changed files
with
790 additions
and
3 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
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
61 changes: 61 additions & 0 deletions
61
src/library-authoring/library-team/AddLibraryTeamMember.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,61 @@ | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { | ||
Button, | ||
Form, | ||
ActionRow, | ||
} from '@openedx/paragon'; | ||
import { Formik } from 'formik'; | ||
|
||
import messages from './messages'; | ||
import FormikControl from '../../generic/FormikControl'; | ||
import { EXAMPLE_USER_EMAIL } from './constants'; | ||
|
||
const AddLibraryTeamMember = ({ onSubmit, onCancel }: { | ||
onSubmit: ({ email } : { email: string }) => void, | ||
onCancel: () => void, | ||
}) => { | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<div className="add-user-form" data-testid="add-user-form"> | ||
<Formik | ||
initialValues={{ email: '' }} | ||
onSubmit={onSubmit} | ||
validateOnBlur | ||
> | ||
{({ handleSubmit, values }) => ( | ||
<Form onSubmit={handleSubmit}> | ||
<Form.Group size="sm" className="form-field"> | ||
<h3 className="form-title">{intl.formatMessage(messages.addMemberFormTitle)}</h3> | ||
<Form.Label size="sm" className="form-label font-weight-bold"> | ||
{intl.formatMessage(messages.addMemberFormEmailLabel)} | ||
</Form.Label> | ||
<FormikControl | ||
name="email" | ||
value={values.email} | ||
placeholder={intl.formatMessage(messages.addMemberFormEmailPlaceholder, { email: EXAMPLE_USER_EMAIL })} | ||
/> | ||
<Form.Control.Feedback className="form-helper-text"> | ||
{intl.formatMessage(messages.addMemberFormEmailHelperText)} | ||
</Form.Control.Feedback> | ||
</Form.Group> | ||
<ActionRow> | ||
<Button variant="tertiary" size="sm" onClick={onCancel}> | ||
{intl.formatMessage(messages.cancelButton)} | ||
</Button> | ||
<Button | ||
size="sm" | ||
type="submit" | ||
disabled={!values.email.length} | ||
> | ||
{intl.formatMessage(messages.addMemberFormSubmitButton)} | ||
</Button> | ||
</ActionRow> | ||
</Form> | ||
)} | ||
</Formik> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AddLibraryTeamMember; |
Oops, something went wrong.