-
Notifications
You must be signed in to change notification settings - Fork 16
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 support via changing slide order #137
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c06374e
Add RTL demo
weotch cdc6da2
Add rtl prop
weotch a76c0f5
Show UI in the demo
weotch 2c6dda1
Reverse the slide order an auto-set to final index if rtl
weotch ac2b552
Reveese aria-labels on arrows in response to rtl
weotch 60579b9
Reverse page number labels
weotch 27652fe
Don’t reverse slide order until width is known
weotch 40bc51b
Wait to set the initial index until width is known
weotch 2766e52
Add dimensionsKnown helper computed prop
weotch deaa201
Fix dot label when not RTL
weotch 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
|
||
<div :style='{ direction: "rtl" }'> | ||
<ssr-carousel rtl show-dots show-arrows> | ||
<slide :index='1'></slide> | ||
<slide :index='2'></slide> | ||
<slide :index='3'></slide> | ||
</ssr-carousel> | ||
</div> | ||
|
||
</template> |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### | ||
Code related to supporting RTL layout | ||
### | ||
export default | ||
|
||
# Add RTL prop | ||
props: rtl: Boolean | ||
|
||
# As an easy way to support rtl, update the index to the final value | ||
# when RTL is enabled. This is change is combined with reversing the order | ||
# of the slides in `ssr-carousel-track`. We're testing for the | ||
# dimensionsKnown value as way to ensure that the final pages count is known | ||
# since it depends on knowing the width of the carousel. | ||
mounted: -> | ||
return unless @rtl | ||
if @dimensionsKnown | ||
then @setInitialRtlIndex() | ||
else unwatch = @$watch 'dimensionsKnown', => | ||
@setInitialRtlIndex() | ||
unwatch() | ||
|
||
methods: | ||
|
||
# This should only be called once. Wait a tick so we're sure that the | ||
# pages value has been calculated | ||
setInitialRtlIndex: -> | ||
setTimeout => | ||
@index = @pages - @value - 1 | ||
@jumpToIndex @index | ||
, 0 |
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
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.
@azerozvn I realized one possible issue with this change. I'm setting the direction of the carousel wrapper to
ltr
so that my reversing of the order works as intended. However, this means that the slides will inherit this setting.Like notice how the slide titles here are
ltr
:I want to release a patch fix that sets the carousel track contents to
direction: rtl
when thertl
prop of the container is set. See any issue with that?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.
Alright @azerozvn this change was released as v2.4.1 if you wanna upgrade to it. See #138.
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.
Thank you, and sorry I forgot to answer you here, I've updated
sites-rtl
to use2.4.1