Skip to content

Commit 1d4c415

Browse files
committed
Updated the file picker with global classnames and properties
1 parent 7df5535 commit 1d4c415

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/controls/filePicker/FilePicker.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
6565
public render(): JSX.Element {
6666
// If no acceptable file type was passed, and we're expecting images, set the default image filter
6767
const accepts: string[] = this.props.accepts;
68+
const buttonClassName :string = this.props.buttonClassName ? this.props.buttonClassName : '';
69+
const panelClassName :string = this.props.panelClassName ? this.props.panelClassName : '';
6870

6971
const linkTabProps = {
7072
accepts: accepts,
@@ -75,24 +77,25 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
7577
const buttonProps = {
7678
text: this.props.buttonLabel,
7779
disabled: this.props.disabled,
78-
onClick: this._handleOpenPanel
80+
onClick: this._handleOpenPanel,
81+
className: `pnp__file-picker__button ${buttonClassName}`
7982
};
8083

8184
return (
82-
<div >
85+
<div className={`pnp__file-picker`}>
8386
{
8487
this.props.label && <Label required={this.props.required}>{this.props.label}</Label>
8588
}
8689
{
8790
this.props.buttonIcon ?
8891
<ActionButton iconProps={{ iconName: this.props.buttonIcon }} {...buttonProps} /> :
89-
<PrimaryButton {...buttonProps}/>
92+
<PrimaryButton {...buttonProps} />
9093
}
9194

9295
<Panel isOpen={this.state.panelOpen}
9396
isBlocking={true}
9497
hasCloseButton={true}
95-
className={styles.filePicker}
98+
className={`pnp__file-picker__panel ${styles.filePicker} ${panelClassName}`}
9699
onDismiss={this._handleClosePanel}
97100
type={PanelType.extraLarge}
98101
isFooterAtBottom={true}

src/controls/filePicker/IFilePickerProps.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ export interface IFilePickerProps {
3232
*/
3333
context: ExtensionContext | WebPartContext;
3434

35+
/**
36+
* ClassName to be applied to the opener button element.
37+
*/
38+
buttonClassName?: string;
39+
40+
/**
41+
* ClassName to be applied to the Panel root element.
42+
*/
43+
panelClassName?: string;
44+
3545
/**
3646
* File extensions to be displayed.
3747
*/

src/controls/filePicker/controls/DocumentLibraryBrowser/DocumentLibraryBrowser.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
font-size: 21px;
7676
font-weight: 600;
7777

78+
:global .ms-Button-textContainer {
79+
max-width: 100%;
80+
word-break: break-word;
81+
}
82+
7883
&:hover {
7984
color: $ms-color-neutralLight;
8085
background-color: rgba(0, 0, 0, 0.6);

0 commit comments

Comments
 (0)