Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

feat: use navigator language to define rtl or ltr #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<template>
<div>

<div :dir="dir">
<Menu />
<sui-segment attached="bottom">
<router-view />
</sui-segment>

</div>
</template>

<script>

import Menu from "./components/Menu";

export default {
name: "app",
components: { Menu },
data: function() {
return {};
}
var userLang = navigator.language || navigator.userLanguage;

return { dir: ["he", "ar"].includes(userLang) ? "rtl" : "ltr" };
},
};
</script>

Expand All @@ -28,6 +27,6 @@ export default {
}

.segment {
border: none!important;
border: none !important;
}
</style>
10 changes: 5 additions & 5 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{{ item.label }}
</router-link>

<sui-menu-menu position="right">
<sui-menu-menu style="margin-inline-start: auto;">
<sui-menu-item v-on:click="openHelper" class="helpButton">
<sui-icon name="help" />
</sui-menu-item>
Expand All @@ -51,7 +51,7 @@ const intialSettings = localSettings.fetch();
localSettings.update("tuto-done", true);

export default {
data: function () {
data: function() {
return {
menu: [
{ label: this.$t("menu.games") },
Expand All @@ -68,17 +68,17 @@ export default {
},
components: { Helper },
computed: {
menuItems: function () {
menuItems: function() {
return this.menu.filter((item) => {
return item.to;
});
},
},
methods: {
closeHelper: function () {
closeHelper: function() {
this.helperIsOpen = false;
},
openHelper: function () {
openHelper: function() {
this.helperIsOpen = true;
},
},
Expand Down