Skip to content

Commit 09dc8b1

Browse files
LanguafeVesaJuvonen
authored andcommitted
Conditionally render search button (SharePoint#3410)
Only show the search button if the clientMode property of the GraphConsumer component has been set.
1 parent 66d4ce0 commit 09dc8b1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

docs/spfx/use-aad-tutorial.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ Now you can update the **GraphConsumer** React component under the *src/webparts
317317

318318
```typescript
319319
public render(): React.ReactElement<IGraphConsumerProps> {
320+
const { clientMode } = this.props;
320321
return (
321322
<div className={ styles.graphConsumer }>
322323
<div className={ styles.container }>
@@ -332,13 +333,17 @@ Now you can update the **GraphConsumer** React component under the *src/webparts
332333
onGetErrorMessage={ this._getSearchForErrorMessage }
333334
/>
334335
</p>
335-
<p className={ styles.form }>
336-
<PrimaryButton
337-
text='Search'
338-
title='Search'
339-
onClick={ this._search }
340-
/>
341-
</p>
336+
{
337+
(clientMode === ClientMode.aad || clientMode === ClientMode.graph) ?
338+
<p className={styles.form}>
339+
<PrimaryButton
340+
text='Search'
341+
title='Search'
342+
onClick={this._search}
343+
/>
344+
</p>
345+
: <p>Configure client mode by editing web part properties.</p>
346+
}
342347
{
343348
(this.state.users != null && this.state.users.length > 0) ?
344349
<p className={ styles.form }>

0 commit comments

Comments
 (0)