-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/icon-picker' of https://github.com/Konradox/sp-…
…dev-fx-controls-react into Konradox-feature/icon-picker
- Loading branch information
Showing
42 changed files
with
2,179 additions
and
28 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# IconPicker control | ||
|
||
Control that allows to search and select an icon from office-ui-fabric-react icons. | ||
|
||
## Overview | ||
The control allows selecting an icon from the list of icons available in the office-ui-fabric-react library. Icon list is a static copy of available icons. Currently, only one icon selection is supported. | ||
![Icon Picker overview](../assets/IconPickerOverview.png) | ||
|
||
|
||
## Displayed in the panel | ||
Icon picker always opens a new panel where you can pick an icon. The panel displays all the icons and maintains readability. Picker does not displays selected icon outside the panel. | ||
![Icon Picker panel](../assets/IconPickerPanel.gif) | ||
|
||
|
||
## How to use this control | ||
|
||
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency. | ||
- Import the following module to your component: | ||
|
||
```TypeScript | ||
import { IconPicker } from '@pnp/spfx-controls-react/lib/IconPicker'; | ||
``` | ||
|
||
- Use the `IconPicker` control in your code as follows: | ||
|
||
```TypeScript | ||
<IconPicker | ||
buttonLabel={'Icon'} | ||
onChange={(iconName: string) => { this.setState({icon: iconName}); }} | ||
onSave={(iconName: string) => { this.setState({icon: iconName}); }} | ||
/> | ||
``` | ||
|
||
## Implementation | ||
|
||
The IconPicker component can be configured with the following properties: | ||
|
||
| Property | Type | Required | Description | | ||
| ---- | ---- | ---- | ---- | | ||
| buttonLabel | string | no | Specifies the label of the icon picker button. | | ||
| onSave | (iconName: string) => void | yes | Handler when the icon has been selected and picker has been closed. | | ||
| onChange | (iconName: string) => void | no | Handler when the icon selection has been changed. | | ||
| disabled | boolean | no | Specifies if the picker button is disabled | | ||
| buttonClassName | boolean | no | If provided, additional class name will be added to the picker button | | ||
| panelClassName | boolean | no | If provided, additional class name will be added to the picker panel | | ||
| currentIcon | boolean | no | Specifies default selected icon | | ||
|
||
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/IconPicker) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './controls/iconPicker/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export interface IIconPickerProps { | ||
/** | ||
* call-back function when icon selection has been confirmed | ||
*/ | ||
onSave(iconName: string): void; | ||
/** | ||
* call-back function when icon has changed | ||
*/ | ||
onChange?(iconName: string): void; | ||
/** | ||
* Specifies the label of the icon picker button | ||
*/ | ||
buttonLabel?: string; | ||
/** | ||
* Specifies if the picker button is disabled | ||
*/ | ||
disabled?: boolean; | ||
/** | ||
* Specifies a custom className for the picker button | ||
*/ | ||
buttonClassName?: string; | ||
/** | ||
* Specifies a custom className for the panel element | ||
*/ | ||
panelClassName?: string; | ||
/** | ||
* initially selected icon | ||
*/ | ||
currentIcon?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface IIconPickerState { | ||
items: string[]; | ||
currentIcon?: string; | ||
isPanelOpen: boolean; | ||
} |
Oops, something went wrong.