Skip to content
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

[RTL] Fix the SDP and DRP noflip util function #1492

Merged

Conversation

yzimet
Copy link
Contributor

@yzimet yzimet commented Dec 12, 2018

Summary

In #1482 we added compatibility with react-with-direction. In the process we
created a helper utility noflip to make it so that react-with-direction
wouldn't interfere with the preexisting isRTL flag. This PR fixes the noflip
behavior for Numbers, and adds unit tests.

to: @majapw @ljharb @airbnb/ui-frameworks

Screenshot

example: DateRangePicker: with DirectionProvider

before
image

after
image

In react-dates#1482 we added compatibility with react-with-direction. In the process we
created a helper utility `noflip` to make it so that react-with-direction
wouldn't interfere with the preexisting `isRTL` flag. This PR fixes the noflip
behavior for Numbers, and adds unit tests.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 85.137% when pulling 5578649 on yzimet:yaniv_fix_noflip_react_with_direction into c0ae8ae on airbnb:master.

Copy link
Collaborator

@majapw majapw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! You're a better engineer than I am. 😭

@@ -4,7 +4,7 @@ const NOFLIP = '/* @noflip */';
// flipped in RTL contexts. This should be used only in situations where the style must remain
// unflipped regardless of direction context. See: https://github.com/kentcdodds/rtl-css-js#usage
export default function noflip(value) {
if (typeof value === 'number') return `${value}px`;
if (typeof value === 'number') return `${value}px ${NOFLIP}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOPS. 😱

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specs ftw

@ljharb ljharb added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Dec 12, 2018
@majapw majapw merged commit f071ac9 into react-dates:master Dec 12, 2018
@yzimet yzimet deleted the yaniv_fix_noflip_react_with_direction branch December 13, 2018 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants