Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: added additional props for File Picker #668

Merged
merged 3 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}