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

Support RTL animation #77

Closed
saadaouad opened this issue Mar 10, 2021 · 7 comments
Closed

Support RTL animation #77

saadaouad opened this issue Mar 10, 2021 · 7 comments
Projects

Comments

@saadaouad
Copy link

First of all I'd like to thank you for this great package,

Right now there is no support for RTL skeleton animation, is there a way to add a direction (direction: string, Defaults to ltr) or rtl (rtl: boolean Defaults to false) prop on SkeletonTheme component to deal with that?

Happy to help on that!

@dvtng
Copy link
Owner

dvtng commented Mar 10, 2021

I'd love to support this. I wonder if detecting that the document is using RTL and changing the animation direction automatically would work? E.g. by using https://developer.mozilla.org/en-US/docs/Web/CSS/:dir

@saadaouad
Copy link
Author

It will change only the element direction and not the animation

@saadaouad
Copy link
Author

Since are you using animation CSS property, the only way to change the animation direction is to use animation-direction property.

Right now we can set that only on Skeleton component using className/style properties which will be repetitive if you are using many Skeleton components.

A better way to deal with that in my opinion is to set a new property (direction) on SkeletonTheme component and change the animation-direction value from normal to reverse according to direction value (rtl/ltr).

@dvtng
Copy link
Owner

dvtng commented Mar 10, 2021

Ah sorry I didn't explain my idea well. I meant that we can modify the library so that it already comes with CSS that detects if a skeleton is in a rtl document (or section), and if so apply animation-direction: reverse by itself. This would maintain the ethos that the skeleton should automatically adapt to the contents of your page, rather than having to manually specify the direction in some another way. It seems that the :dir pseudo-selector I mentioned earlier has limited browser support, but if your page is using the dir HTML attribute then we could still make the idea work.

@saadaouad
Copy link
Author

I opened a PR for it @dvtng #78, hopefully it will work

@jaril5976
Copy link

Hello @saadaouad @dvtng last open PR looks good to me, please merge it and issue will be fixed, we are waiting for rtl props to skeletontheme, Thanks!!

@jaril5976
Copy link

I had fixed this issue with this

${({theme:{isRTL}}) => isRTL && css`
    .react-loading-skeleton {
      animation-direction: reverse;
    }
  `}

@srmagura srmagura added this to To do in Version 3 Sep 29, 2021
@srmagura srmagura moved this from To do to In progress in Version 3 Oct 8, 2021
Version 3 automation moved this from In progress to Done Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants