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

feat: RTL support #659

Conversation

kamaladenalhomsi
Copy link
Contributor

@kamaladenalhomsi kamaladenalhomsi commented Sep 3, 2019

Hi everyone!
in this PR, Vuesax is now supporting RTL completely!
I've checked every component, to make sure that the native LTR did not change,
and to make sure that each component supports RTL

How to use?

to activate RTL, you can pass the rtl option when calling function use()

import Vue from 'vue'
import Vuesax from 'vuesax'

Vue.use(Vuesax, {
  rtl: true
})

if you want to turn on or off RTL at any time, you can just write:

this.$vs.rtl = true // or false

this.$vs.rtl is also reactive, so you can use Vue watcher as below:

watch: {
  "$vs.rtl": {
     handler(val) {
      console.log(val)
    }
  }
}

Updates on Vuesax in this PR

RTL support feature based on two mixins, propWithDir & dirValue
I explained each one of them in the mixins.styl file, I hope you check it out
one of the major changes I did, that I used Vue.prototype._init function
to parse properties, and access the Vue instance, check override.js
I added a new file in

utils/rtl.js

this file contains the RTL logic,
the logic of the RTL is based on injecting vuesax-app-is-rtl class in the HTML element
in case of RTL, and it will Inject vuesax-app-is-ltr in ltr case,
the two mixins, propWithDir & dirValue, will create new two classes
one for the RTL, another one for the LTR directions
example:

.someClass
  propWithDir(padding, left, 10px)

[Compiled]

.vuesax-app-is-rtl
  .someClass
    padding-right: 10p

.vuesax-app-is-ltr
  .someClass
    padding-left: 10px

the full explanation of propWithDir & dirValue mixins in mixins.styl file

Resolve #93 #176 #581

kamaladenalhomsi and others added 7 commits August 26, 2019 13:19
check if style is rtl, a 'vuesax-app-is-rtl' will be injected into the html tag
feat: add 'propWithDir' and 'dirValue' mixins
feat: add rtl property to options
feat: inject the approprite class for rtl and ltr
feat: dirValue & propWithDir stylus mixins
feat: support RTL in all components expect 'vsDropDown'
feat: make 'vsDropDown' component support RTL
fix: rtl property check
@luisDanielRoviraContreras luisDanielRoviraContreras merged commit 86f9645 into lusaxweb:master Sep 5, 2019
Tofandel pushed a commit to Tofandel/fixed-vuesax that referenced this pull request Apr 26, 2021
Tofandel pushed a commit to Tofandel/fixed-vuesax that referenced this pull request Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support RTL direction
2 participants