0.0.1-alpha.0 • Published 5 years ago
assignment-modal v0.0.1-alpha.0
Assignment Modal
A modal used for assigning users, teams, and plans.
Installation
yarn add @pluralsight/assignment-modalor
npm install @pluralsight/assignment-modalUsage
import AssignmentModal from '@pluralsight/assignment-modal'
...
<AssignmentModal
title="Add members"
directory={directoryItems}
searchResults={searchResultItems}
onLoad={handleOnLoad}
onSearch={handleOnSearch}
onSubmit={handleOnSubmit}
submitButtonLabel="Add members"
onCancel={handleOnCancel}
analytics={{
analyticsFacade: analyticsFacadeInstance,
boundedContext: 'channels',
source: 'channels/details'
}}
/>Props
Required
titledirectory- data for shown teams and users. Array of objects with:idtype- user, team, or plannamegravatarHash- for users onlyrole- the role of the item if it’s already assignedchildren- (optional) array of this same shapeisLoadingChildren- (optional) shows spinner
searchResults- same shape asdirectory. Used to show search results instead of the browse state.onLoad- function to call when items need to be loaded. Should update data passed to directory prop. Params:parentId- the ID of the item to load children for (null if loading top level)page- the page to load (0 for initial load)
onSearch- function to call when a search is performed. Should update the directory prop. Params:searchTextpage- the page to load (zero-based)
onSubmit- function to call when submitting. Params:selectedItems- array of objects with:idtype- user, team, or planname
selectedRole- value of selected roleshouldSendNotificationnotificationText
submitButtonLabel- text to show in submit button. In confirm modal will be prepended with “Yes, “onCancel- function called on X button click or Cancel Confirmation modal submitanalytics- object with:analyticsFacade- Your app’s analytics facade instanceboundedContext- the name of the BC where the component is being usedsource- the area of your BC the widget is being used
Optional
roles- list of roles to show in dropdown. Array of:namedescriptionvalue
shareLink- URL to copy to clipboardshareText- text to show next to the copy link buttonshowNotificationSettings- if true show the notification stepnotificationTextPlaceholderrenderConfirmationTitle- function that will be called to render the confirmation modal title. Should return a string. Params:selectedItems- same shape as inonSubmit
renderConfirmationMessage- function that will be called to render the confirmation modal text. Should return a string. If null is returned, no confirmation will show. Params:selectedItems- same shape as inonSubmit
renderCancelConfirmationMessage- function that will be called to render the cancel confirmation modal text. Should return a string. If null is returned, no confirmation will show. Params:selectedItems- same shape as inonSubmit
0.0.1-alpha.0
5 years ago