-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from BKWLD/rtl-support-via-changing-slide-order
RTL support via changing slide order
- Loading branch information
Showing
9 changed files
with
124 additions
and
28 deletions.
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