-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Creating react-file-type-icons package for v9 #35515
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
Open
bigbadcapers
wants to merge
121
commits into
microsoft:master
Choose a base branch
from
bigbadcapers:caperez/filetype-icons-for-v9
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
121 commits
Select commit
Hold shift + click to select a range
9fba299
Adding `portfolio` (Microsoft Project item type) to the list of non-f…
bigbadcapers 63f928c
More filetype support.
bigbadcapers 3ccf0e3
update CDN url and typo
bigbadcapers fab6a3a
yarn change
bigbadcapers 55294b5
API update (from yarn nx run-many -t build)
bigbadcapers f025f9e
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers bbeb40a
Ran `yarn nx format`
bigbadcapers 0bcee33
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers a7180bf
Merge branch 'caperez/sep-filetype-icon-update' of https://github.com…
bigbadcapers 280fe2c
Changing FileIconType-based icon searching to use the same scalable m…
bigbadcapers d87a2a5
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers d9cc656
removing stray outdated yarn change files
bigbadcapers a7884fb
yarn change
bigbadcapers b12c050
Ran `yarn nx format`
bigbadcapers 71faacd
post-refactoring cleanup of an unused type
bigbadcapers d6b0c08
fixing error reported by `lint`: error The body of a for-in should b…
bigbadcapers 60556e3
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 5e51678
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 348dc4d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 22c8545
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 696661f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers fa910b5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 7e42ae8
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 00bbcd6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers e49f620
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 6640d15
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 765313e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 0b1cf0b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 24c626f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers ae68e6d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 4b1d12e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers a41fc17
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers b86c403
adding album entry to filetypeicon mapping
bigbadcapers b5a574c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 3fc8bc6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 4da5e8a
Merge remote-tracking branch 'upstream/master' into caperez/newTypeMe…
bigbadcapers 856c284
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers e1019ad
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers d759bf1
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 91b7b95
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers fe0881e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 17bf0e5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers ddf6351
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers e54435a
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 54df488
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 9f3c6da
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers ada0165
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers ad8552c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers d2c9ff6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 0af5721
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers e7964db
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 1aa9f16
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers cbdba53
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 19cd862
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 209fd2c
Merge branch 'microsoft:master' into caperez/newTypeMethod
bigbadcapers aa8ffda
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers f74d77b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers a19592f
first drop of creating a Fluent v9 version of the react-file-type-ico…
bigbadcapers 0b1c4fb
refreshing filetype icon references in other storybooks to new icon s…
bigbadcapers ce3262c
more touch-ups in other places that reference the CDN url
bigbadcapers e08e1ba
verified new file-type-icons-preview package is rendering icons in th…
bigbadcapers 641eb02
simplified documentation.
bigbadcapers 59298fa
simplifying getFileTypeIconAsURL and getFileTypeIconAsHTMLString
bigbadcapers 792e792
updated storybook / tests to evaluate helper functions
bigbadcapers 3c64988
organizing storybook place in nav
bigbadcapers cbf2f29
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers 27a704e
Merge remote-tracking branch 'origin/caperez/newTypeMethod' into cape…
bigbadcapers 8d379e6
update getFileTypeIconProps to use same mapping file FileTypeIconMap.…
bigbadcapers e51a9c6
new documentation pass 1 (broken)
bigbadcapers 213d6f0
documentation rendering ok, ready to condense
bigbadcapers f0a02bf
refining FileIconType and storybook
bigbadcapers 71338bf
story condensation snapshot
bigbadcapers 93a577b
condensation 2
bigbadcapers 3d484ae
improving alt tag generation in the control itself, removing a11y sto…
bigbadcapers 199803c
ran all pre-checks from plan-testingAndPromotionEnhanced. ready to st…
bigbadcapers 325af7b
package move to remove -preview suffix
bigbadcapers 092682f
first test passed after package rename
bigbadcapers f5b16cc
API update and undoing newFileTypeMethod in v8 package
bigbadcapers baa3430
package semver cleanup, build pass, documentation simplification
bigbadcapers 1f48612
error checking and optimizations
bigbadcapers 5996d70
initializeFileTypeIcons with alternate CDN URL is now honored by new …
bigbadcapers e89bd7b
improved icon size checking, removing unnecessary public exports, fix…
bigbadcapers 917c256
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers 9af6811
cleanup stray API file
bigbadcapers fb25605
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers df430ed
changing v8 package name and adding publishConfig so it emits to the …
bigbadcapers 0204824
updating swc packages and lint tweaks
bigbadcapers 3b2ed13
yarn change
bigbadcapers c5b3ca1
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers 07d1b03
remove private flag from package.json for react-file-type-icons
bigbadcapers b2a45e8
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers 3794169
deduplicating yarn lock and solving plugin issue in react-utilities .…
bigbadcapers 935f967
yarn change for react-utilities
bigbadcapers 237b828
npx yarn-deduplicate --strategy fewer
bigbadcapers cb42047
Add path mapping for react-file-type-icons-v8 in tsconfig.base.all.json
bigbadcapers cfa9fba
re-running yarn nx format:write
bigbadcapers ef929f1
undoing removal of indent rule
bigbadcapers 9824a02
plugin swc-plugin-de-indent-template-literal is crashing, removing
bigbadcapers 9b0917c
yarn change for experimental swc.rs indentation plugin removal
bigbadcapers 2d73b85
fix missing param in documentation for getFileTypeIcon
bigbadcapers 13974b7
Add missing dependency and update styles in file type icon stories
bigbadcapers d949974
lint and yarn change again
bigbadcapers 2d6e940
undoing overeager deletion of a file i had no business touching
bigbadcapers ba6015c
fixing compilation config issues - no change
bigbadcapers c2ad25a
Refactor UrlAndHtml component export and update story parameters
bigbadcapers c31ef7e
Add device pixel ratio state and effect to UrlAndHtml component to pa…
bigbadcapers 6c94223
yarn nx format:write prettier
bigbadcapers 917f878
dead end ci/cd solving ci/main no dice
bigbadcapers ae682cc
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers f1984d1
first late undo
bigbadcapers cb3066c
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers f55e035
attempted reset
bigbadcapers 15c87a6
yarn change in shared-contexts
bigbadcapers 6bfae2c
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers a0f11fd
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers 921aeff
chore: update package dependencies for react and charting components
bigbadcapers 32e1197
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers 91ed548
feat: add public docsite setup for v8 version of file-type-icons package
bigbadcapers 47aec0f
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers 17569a9
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers e740fbf
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
apps/public-docsite/src/pages/Styles/FileTypeIconsPage/FileTypeIconsPage.tsx
This file contains hidden or 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 hidden or 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 hidden or 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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-public-docsite-setup-7ad0c9ff-7dd2-4ebe-a63f-a94d93a6b458.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "Associating this older public docsite with the v8 version of the file-type-icons package (new workspace name got -v8 suffix added)", | ||
| "packageName": "@fluentui/public-docsite-setup", | ||
| "email": "caperez@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-components-a2e03411-e541-4b7c-b342-5ebe7b8cd7ac.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "Adding react-file-type-icons package for FluentUI v9", | ||
| "packageName": "@fluentui/react-components", | ||
| "email": "caperez@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-file-type-icons-0a69cb3d-cf81-4967-8961-6a2ab277c675.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "\u0016\u0016\u0016Chagnging FileIconType-based icon searchign to use the same scalable method used for file extensions", | ||
| "packageName": "@fluentui/react-file-type-icons", | ||
| "email": "caperez@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-file-type-icons-v8-d71e68d3-89bb-4f77-ab67-c4051a45cac2.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "Adding react-file-type-icons package for FluentUI v9. This package is now suffixed with v8 in the repo, but published to the same @fluentui/react-file-type-icons namespace in NPM with no suffix, just retaining the 8.x.x semver.", | ||
| "packageName": "@fluentui/react-file-type-icons-v8", | ||
| "email": "caperez@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-shared-contexts-8bdf4419-527c-4852-accd-686067675ba9.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "including package react-file-type-icons v9", | ||
| "packageName": "@fluentui/react-shared-contexts", | ||
| "email": "caperez@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -26,6 +26,5 @@ | |
| "devDependencies": { | ||
| "@fluentui/eslint-plugin": "*", | ||
| "@fluentui/scripts-tasks": "*" | ||
| }, | ||
| "dependencies": {} | ||
| } | ||
| } | ||
This file contains hidden or 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
4 changes: 4 additions & 0 deletions
4
packages/react-components/react-file-type-icons/library/.babelrc.json
This file contains hidden or 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,4 @@ | ||
| { | ||
| "extends": "../../../../.babelrc-v9.json", | ||
| "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] | ||
| } |
30 changes: 30 additions & 0 deletions
30
packages/react-components/react-file-type-icons/library/.swcrc
This file contains hidden or 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 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/swcrc", | ||
| "exclude": [ | ||
| "/testing", | ||
| "/**/*.cy.ts", | ||
| "/**/*.cy.tsx", | ||
| "/**/*.spec.ts", | ||
| "/**/*.spec.tsx", | ||
| "/**/*.test.ts", | ||
| "/**/*.test.tsx" | ||
| ], | ||
| "jsc": { | ||
| "parser": { | ||
| "syntax": "typescript", | ||
| "tsx": true, | ||
| "decorators": false, | ||
| "dynamicImport": false | ||
| }, | ||
| "externalHelpers": true, | ||
| "transform": { | ||
| "react": { | ||
| "runtime": "classic", | ||
| "useSpread": true | ||
| } | ||
| }, | ||
| "target": "es2019" | ||
| }, | ||
| "minify": false, | ||
| "sourceMaps": true | ||
| } |
15 changes: 15 additions & 0 deletions
15
packages/react-components/react-file-type-icons/library/LICENSE
This file contains hidden or 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,15 @@ | ||
| @fluentui/react-file-type-icons | ||
|
|
||
| Copyright (c) Microsoft Corporation | ||
|
|
||
| All rights reserved. | ||
|
|
||
| MIT License | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license |
142 changes: 142 additions & 0 deletions
142
packages/react-components/react-file-type-icons/library/MIGRATION.md
This file contains hidden or 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,142 @@ | ||
| # Migration Guide: react-file-type-icons to react-file-type-icons | ||
|
|
||
| This guide helps you migrate from `@fluentui/react-file-type-icons` (v8) to `@fluentui/react-file-type-icons` (v9). | ||
|
|
||
| ## Overview | ||
|
|
||
| The v9 version provides a **modern React component-based API** while maintaining **full backward compatibility** with all v8 utility functions. | ||
|
|
||
| **Key Points:** | ||
|
|
||
| - ✅ All v8 utilities exported and work identically | ||
| - ✅ No breaking API changes for utility functions | ||
| - 🆕 New component API available (recommended but optional) | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @fluentui/react-file-type-icons | ||
| ``` | ||
|
|
||
| ## What's Changed | ||
|
|
||
| ### Package Name (Breaking Change) | ||
|
|
||
| The only breaking change is the package name: | ||
|
|
||
| - **Old**: `@fluentui/react-file-type-icons` | ||
| - **New**: `@fluentui/react-file-type-icons` | ||
|
|
||
| ### New Component API (Recommended) | ||
|
|
||
| **v8 (utility-based) - Still works:** | ||
|
|
||
| ```tsx | ||
| import { getFileTypeIconProps } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| const iconProps = getFileTypeIconProps({ extension: 'docx', size: 48 }); | ||
| <img src={iconProps.iconName} alt="Document" />; | ||
| ``` | ||
|
|
||
| **v9 (component-based) - Recommended:** | ||
|
|
||
| ```tsx | ||
| import { FileTypeIcon } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| <FileTypeIcon extension="docx" size={48} />; | ||
| ``` | ||
|
|
||
| ## Migration Examples | ||
|
|
||
| ### Document Icons | ||
|
|
||
| **Before:** | ||
|
|
||
| ```tsx | ||
| import { getFileTypeIconProps } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| function DocumentItem({ filename }) { | ||
| const extension = filename.split('.').pop(); | ||
| const iconProps = getFileTypeIconProps({ extension, size: 32 }); | ||
|
|
||
| return ( | ||
| <div> | ||
| <img src={iconProps.iconName} alt={filename} style={{ width: 32, height: 32 }} /> | ||
| <span>{filename}</span> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| **After:** | ||
|
|
||
| ```tsx | ||
| import { FileTypeIcon } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| function DocumentItem({ filename }) { | ||
| const extension = filename.split('.').pop(); | ||
|
|
||
| return ( | ||
| <div> | ||
| <FileTypeIcon extension={extension} size={32} /> | ||
| <span>{filename}</span> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| ### Folder Icons | ||
|
|
||
| **Before:** | ||
|
|
||
| ```tsx | ||
| import { getFileTypeIconProps, FileIconType } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| const iconProps = getFileTypeIconProps({ type: FileIconType.folder, size: 48 }); | ||
| <img src={iconProps.iconName} alt="Folder" />; | ||
| ``` | ||
|
|
||
| **After:** | ||
|
|
||
| ```tsx | ||
| import { FileTypeIcon, FileIconType } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| <FileTypeIcon type={FileIconType.folder} size={48} />; | ||
| ``` | ||
|
|
||
| ## Incremental Migration | ||
|
|
||
| **You don't have to migrate all code at once!** All v8 utilities work identically in v9: | ||
|
|
||
| ```tsx | ||
| import { | ||
| FileTypeIcon, // v9 component (new) | ||
| getFileTypeIconAsUrl, // v8 utility (still works) | ||
| } from '@fluentui/react-file-type-icons'; | ||
|
|
||
| function MyComponent() { | ||
| return ( | ||
| <div> | ||
| {/* Old code - still works */} | ||
| <img src={getFileTypeIconAsUrl({ extension: 'docx', size: 32 })} alt="Document" /> | ||
|
|
||
| {/* New code - recommended */} | ||
| <FileTypeIcon extension="docx" size={32} /> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| ## Benefits of the New Component API | ||
|
|
||
| 1. **Simpler** - No manual URL handling or img element construction | ||
| 2. **Better TypeScript** - Full type safety with v9's type definitions | ||
| 3. **Accessible** - Built-in alt text and ARIA support | ||
| 4. **Optimized** - Automatic pixel ratio and format handling | ||
|
|
||
| ## Need Help? | ||
|
|
||
| If you encounter issues: | ||
|
|
||
| 1. Check the [Storybook examples](https://aka.ms/fluentui-storybook) | ||
| 2. Open an issue on [GitHub](https://github.com/microsoft/fluentui) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.