-
Notifications
You must be signed in to change notification settings - Fork 328
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
New icon component #12091
Merged
Merged
New icon component #12091
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
95f55ef
New icons component
MrFlashAccount 3549e31
New Icon component
MrFlashAccount a610a65
Add deprecated import
MrFlashAccount 4f86e92
Fix types
MrFlashAccount 4b4bf6f
Fix prettier
MrFlashAccount 7d37076
Fix prettier and types
MrFlashAccount ef34532
Fix icons
MrFlashAccount 1161ff5
Merge branch 'develop' into wip/sergeigarin/icons-rework
mergify[bot] 1007aff
trigger CI
MrFlashAccount eeb8029
trigger CI
MrFlashAccount bf9c4a1
update package manager
MrFlashAccount 0909eb2
try
MrFlashAccount 87d8fd4
corepack enable
MrFlashAccount 45458f0
Workaround
MrFlashAccount ca10fa1
Fix corepack issues
MrFlashAccount 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 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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
/** @file Common types for ARIA components. */ | ||
import type { Icon as PossibleIcon } from '@/util/iconMetadata/iconName' | ||
import type { ReactElement } from 'react' | ||
|
||
import type * as reactAria from 'react-aria' | ||
|
||
/** Props for adding a test id to a component */ | ||
|
@@ -16,16 +18,49 @@ export interface TestIdProps { | |
export type Placement = reactAria.Placement | ||
|
||
/** | ||
* Generic type for any icon | ||
* Type for any icon | ||
*/ | ||
export type IconProp<Icon extends string = string, Render = never> = | ||
| IconPropSvgUse<Render> | ||
| LegacyIconProp<Icon, Render> | ||
|
||
/** | ||
* A type that represents the possible return values for a legacy icon. | ||
*/ | ||
export type IconProp<Render> = | ||
export type LegacyAvialableIconReturn<Icon extends string> = | ||
| LegacyIcon<Icon> | ||
| ReactElement | ||
| string | ||
| false | ||
| ((render: Render) => ReactElement | string | false | null | undefined) | ||
| null | ||
| undefined | ||
|
||
/** | ||
* A type that represents the possible return values for a legacy icon. | ||
*/ | ||
export type AvailableIconReturn = ReactElement | SvgUseIcon | false | null | undefined | ||
|
||
/** | ||
* Generic type for any icon | ||
* @deprecated Prefer defined keys over importing from `#/assets/*.svg | ||
*/ | ||
export type LegacyIconProp<Icon extends string, Render> = | ||
| LegacyAvialableIconReturn<Icon> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be |
||
| ((render: Render) => LegacyAvialableIconReturn<Icon>) | ||
|
||
/** | ||
* Generic type for imported from figma icons | ||
*/ | ||
export type IconPropSvgUse<Render> = AvailableIconReturn | ((render: Render) => AvailableIconReturn) | ||
|
||
/** | ||
* @deprecated | ||
*/ | ||
export type LegacyIcon<T extends string> = Exclude<T, PossibleIcon> & {} | ||
|
||
/** | ||
* Type for any icon imported from figma | ||
*/ | ||
export type SvgUseIcon = PossibleIcon | ||
/** | ||
* Generic type for any addon | ||
*/ | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added export here to have a canvas with all icons in Storybook