-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from levelsoftware/feature/customizable-icons
feature: Ability to customize icons; avoid large icon dependency
- Loading branch information
Showing
20 changed files
with
3,874 additions
and
526 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
/node_modules | ||
/umd | ||
npm-debug.log* | ||
.vscode |
File renamed without changes.
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,95 @@ | ||
Default icons are selected from [Font Awesome](https://fontawesome.com/) for controls and file types. These icons can be customized in two different ways: | ||
|
||
### Custom Icon Map | ||
|
||
You can pass a map to override the default icons with alternatives from Font Awesome. You'll need to install the Font Awesome package that contains your desired icon. | ||
|
||
```bash | ||
npm install @fortawesome/free-brands-svg-icons | ||
``` | ||
|
||
Then, pass your map with overrides to `FileBrowser`. | ||
|
||
```js | ||
import { faCodepen } from '@fortawesome/free-brands-svg-icons'; | ||
|
||
<FileBrowser icons={{ code: faCodepen }}> | ||
``` | ||
|
||
### Custom Icon Component w/ Map | ||
|
||
You can implement a whole new `Icon` component to render icons, that accepts icons from your custom map of icons. Remember that by default, the map will contain Font Awesome ligatures. Your `Icon` component should implement the following `IconProps` props, based on a subset of `FontAwesomeIcon`. | ||
|
||
```typescript | ||
export interface IconProps { | ||
icon: any; | ||
spin?: boolean; | ||
className?: string; | ||
color?: string; | ||
fixedWidth?: boolean; | ||
size?: 'xs' | 'lg' | 'sm'; | ||
style?: CSSProperties; | ||
} | ||
``` | ||
|
||
You can then pass your icon component to the FileBrowser: | ||
|
||
```javascript | ||
<FileBrowser icons={{ code: faCodepen }} Icon={MyIconComponent}> | ||
``` | ||
|
||
Your icon component will be called wherever an icon exists in the UI: | ||
|
||
```javascript | ||
<Icon icon={icons.code} /> | ||
``` | ||
|
||
### Available Icons | ||
|
||
- checkActive | ||
- checkInactive | ||
- desc | ||
- asc | ||
- list | ||
- folder | ||
- folderCreate | ||
- folderOpen | ||
- smallThumbnail | ||
- largetThumbnail | ||
- angleRight | ||
- angleDown | ||
- download | ||
- upload | ||
- trash | ||
- directoryUp | ||
- fallbackIcon | ||
- symlink | ||
- hidden | ||
- loading | ||
- file | ||
- license | ||
- code | ||
- config | ||
- model | ||
- database | ||
- text | ||
- archive | ||
- csv | ||
- image | ||
- word | ||
- video | ||
- info | ||
- key | ||
- lock | ||
- music | ||
- flash | ||
- terminal | ||
- authors | ||
- adobe | ||
- git | ||
- linux | ||
- nodejs | ||
- php | ||
- python | ||
- ubuntu |
Oops, something went wrong.