Skip to content

Commit

Permalink
Merge pull request #668 from gautamdsheth/feature/additionalFilePicke…
Browse files Browse the repository at this point in the history
…rProps

Feature: added additional props for File Picker
  • Loading branch information
estruyf authored Sep 18, 2020
2 parents 5faa158 + 8f649f6 commit be69314
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/controls/filePicker/FilePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
this.fileSearchService = new FilesSearchService(props.context, this.props.bingAPIKey);

this.state = {
panelOpen: false,
panelOpen: this.props.isPanelOpen || false,
organisationAssetsEnabled: false,
showFullNav: true
};
Expand Down Expand Up @@ -206,6 +206,9 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
* Closes the panel
*/
private _handleClosePanel = () => {
if (this.props.onCancel) {
this.props.onCancel();
}
this.setState({
panelOpen: false
});
Expand Down
8 changes: 8 additions & 0 deletions src/controls/filePicker/IFilePickerProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,12 @@ export interface IFilePickerProps {
* @default true
*/
storeLastActiveTab?: boolean;
/**
* Specifies if the file picker panel is open by default or not
*/
isPanelOpen?: boolean;
/**
* Handler when file picker has been cancelled.
*/
onCancel?: () => void;
}

0 comments on commit be69314

Please sign in to comment.