-
Notifications
You must be signed in to change notification settings - Fork 761
Add context to provide rtl support for react-icons #560
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
tomi-msft
wants to merge
43
commits into
microsoft:main
Choose a base branch
from
tomi-msft:react-icons-rtl
base: main
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 2 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
31c7a3f
Automate bumping react-icons beta version number
tomi-msft 47fae8d
revert
tomi-msft 8f81a86
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 179a3e7
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 55e3032
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 1cfdd33
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 66d5a05
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft c84e246
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 80bef55
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 37a69cb
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 39b3d32
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 9c0439c
remove manifest.json
tomi-msft fd04253
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 53e77d3
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft afb2431
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 7507fae
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 3b6e5f9
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft b502589
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 0d89f78
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 66f1019
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 6832725
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 5327af7
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 7b0bbb9
Release 1.1.179
fluentCI adab308
Merge branch 'master' of https://github.com/microsoft/fluentui-system…
tomi-msft 10cf5fe
merge with main
tomi-msft 3ec81c8
revert
tomi-msft 74ea042
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 934daf2
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 71ecb5b
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 772f374
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 995334e
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft b0573ab
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft a1e8486
Add context to provide rtl support for react-icons
tomi-msft 8fabcae
remove wrapIcon and consolidate logic
tomi-msft 9da091e
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 9e1d6e9
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 07e1691
Add autoflipping logic to build script
tomi-msft 3a10737
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft dfdc77e
Merge branch 'main' of https://github.com/microsoft/fluentui-system-i…
tomi-msft 12b991c
merge with main
tomi-msft f7f417f
incorporate changes to icon build into auto-flipping
tomi-msft 1573195
merge
tomi-msft bc6674b
remove test filter script
tomi-msft 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import * as React from 'react'; | ||
|
|
||
| const IconDirectionContext = React.createContext<IconDirectionContextValue | undefined>(undefined); | ||
|
|
||
| export interface IconDirectionContextValue { | ||
| textDirection?: 'ltr' | 'rtl' | ||
| } | ||
|
|
||
| const IconDirectionContextDefaultValue: IconDirectionContextValue = {}; | ||
|
|
||
| export const IconDirectionContextProvider = IconDirectionContext.Provider; | ||
|
|
||
| export const useIconContext = () => React.useContext(IconDirectionContext) ?? IconDirectionContextDefaultValue; |
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 @@ | ||
| export * from './IconDirectionContext'; |
15 changes: 15 additions & 0 deletions
15
packages/react-icons/src/utils/useAutoFlippingIconStyles.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { FluentIconsProps } from "./FluentIconsProps.types"; | ||
| import { makeStyles, mergeClasses } from "@griffel/react"; | ||
| import { useIconContext } from "../contexts"; | ||
|
|
||
| const useFlipStyles = makeStyles({ | ||
| flipped: { | ||
| transform: 'scaleX(-1)' | ||
| } | ||
| }); | ||
|
|
||
| export const useAutoFlippingIconStyles = (state: FluentIconsProps) => { | ||
| const iconContext = useIconContext(); | ||
| const styles = useFlipStyles(); | ||
| state.className = mergeClasses(iconContext.textDirection === 'rtl' && styles.flipped, state.className) | ||
| } | ||
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 was deleted.
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.