This repository was archived by the owner on Jan 20, 2022. It is now read-only.
feat: pass RTL flag to rules function#109
Merged
Conversation
levithomason
approved these changes
Jul 18, 2018
Member
levithomason
left a comment
There was a problem hiding this comment.
Consider comments and merge.
src/components/Provider/Provider.tsx
Outdated
| // ensure we don't assign `undefined` values to the theme context | ||
| // they will override values down stream | ||
| const theme: any = {} | ||
| const theme: any = { isRtl: !!this.props.rtl } |
Member
There was a problem hiding this comment.
Please destructure rtl at the top of the function with the other props.
I propose we don't rename props as they pass from the Provider to the theme. It adds unnecessary thinking to follow renames.
Member
|
Yep, this is required. Please see comment and then merge. |
Collaborator
Author
|
comments are addressed |
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
=======================================
Coverage 69.94% 69.94%
=======================================
Files 74 74
Lines 1198 1198
Branches 227 227
=======================================
Hits 838 838
Misses 355 355
Partials 5 5
Continue to review full report at Codecov.
|
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This change is necessary for the sake of component styles being able to adapt to current presence of RTL mode.
As an example, suppose that we have a Chat Message component with the following layout
Relevant thing for us is the fact that 'timestamp' region has left padding, to ensure it won't overlap content of the 'author' area. However, in the RTL mode we would like this padding being applied on the right side of the component, not still on the left one:
But, unfortunately, at the moment we are unable to detect whether RTL is enabled from the 'rules' function. What would solve the problem is that if we would pass
isRtlflag to rules functions, such that the following will be possible: