- {{ $t(`settings.${locale.split('.')[0]}.items.${locale.split('.')[1]}`) }}
+ {{ $t(`settings.${locale.split('.')[0]}.items.${locale.substring(locale.indexOf('.') + 1)}`) }}
@@ -35,4 +35,4 @@ export default defineComponent({
});
-
+
diff --git a/src/components/Selectbox.vue b/src/components/Selectbox.vue
new file mode 100644
index 0000000..a297898
--- /dev/null
+++ b/src/components/Selectbox.vue
@@ -0,0 +1,77 @@
+
+
+
{{ $t(this.trueLocale) }}
+
+
+
+
+
{{ lang.available[lang.selected] }}
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/settings.ts b/src/pages/settings.ts
index 09d3295..448ef57 100644
--- a/src/pages/settings.ts
+++ b/src/pages/settings.ts
@@ -3,16 +3,32 @@ import { createI18n } from 'vue-i18n';
import Window from '../ts/neutralino/Window';
-import Checkbox from '../components/Checkbox.vue';
import Locales from '../ts/core/Locales';
+import Checkbox from '../components/Checkbox.vue';
+import Selectbox from '../components/Selectbox.vue';
+
const app = createApp({
data: () => ({
- title: 'about'
+ title: 'about',
+
+ // Languages selection
+ languages: {
+ 'en-us': 'English (US)',
+ 'ru-ru': 'Russian'
+ }
}),
+ provide()
+ {
+ return {
+ languages: this.languages
+ };
+ },
+
components: {
- 'l-checkbox': Checkbox
+ 'l-checkbox': Checkbox,
+ 'l-selectbox': Selectbox
},
mounted: () => Window.current.show()
@@ -20,8 +36,8 @@ const app = createApp({
Locales.get().then((locales) => {
app.use(createI18n({
- locale: 'en',
- fallbackLocale: 'en',
+ locale: 'en-us',
+ fallbackLocale: 'en-us',
// @ts-expect-error
messages: locales
diff --git a/src/sass/components.sass b/src/sass/components.sass
index 9cfe8ee..5d0e20a 100644
--- a/src/sass/components.sass
+++ b/src/sass/components.sass
@@ -220,189 +220,6 @@
img.item-delete
display: block
- /* Checkbox */
-
- .checkbox
- display: inline-flex !important
- align-items: center
-
- font-size: larger
-
- width: calc(100% - 24px)
- height: 48px
- padding: 0 12px
-
- border-radius: 12px
-
- .checkbox-mark
- display: flex
-
- background-color: map.get($theme-map, "background2")
-
- border-radius: 16px
- margin-left: auto
- padding: 8px 16px
-
- cursor: pointer
-
- &:hover
- background-color: map.get($theme-map, "primary")
-
- svg
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- svg
- height: 12px
- width: 12px
-
- @if $theme-name == dark
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- .checkbox-disabled
- background-color: map.get($theme-map, "background1")
-
- .checkbox-mark
- display: none
-
- .checkbox-active
- .checkbox-mark
- background-color: map.get($theme-map, "primary")
-
- svg
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- .selectable-checkbox
- cursor: pointer
-
- &:hover
- background-color: map.get($theme-map, "background2")
-
- .checkbox-active:is(.selectable-checkbox)
- background-color: map.get($theme-map, "background2")
-
- /* Select box */
-
- .select
- display: inline-flex
- align-items: center
-
- font-size: larger
-
- width: calc(100% - 24px)
- height: 48px
- padding: 0 12px
-
- border-radius: 12px
-
- .select-options
- position: absolute
- display: none
-
- max-height: 230px
- overflow: auto
-
- background-color: map.get($theme-map, "select-boxes")
- border-radius: 12px
-
- box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
-
- padding: 8px 12px
- transform: translateY(calc(50% + 32px))
-
- right: 32px
-
- cursor: pointer
-
- z-index: 1
-
- @if $theme-name == dark
- &::-webkit-scrollbar-track
- background-color: map.get($theme-map, "background2")
-
- &::-webkit-scrollbar-thumb
- background: #d8dee9
-
- &:hover
- background: #e5e9f0
-
- ul
- list-style: none
-
- padding: 0
- margin: 0
-
- li
- color: #8592a3
- font-size: smaller
-
- border-radius: 8px
-
- padding: 8px 12px
- margin: 0 -4px
-
- &:hover:not([disabled])
- background-color: map.get($theme-map, "background2")
- color: map.get($theme-map, "primary")
-
- &[disabled]
- display: block
- color: #b2c0d3
- cursor: default
-
- li:not(last-child)
- margin-bottom: 4px
-
- li.selected
- background-color: map.get($theme-map, "background2")
- color: map.get($theme-map, "primary")
-
- .selected-item
- display: flex
- align-items: baseline
-
- font-size: initial
-
- background-color: map.get($theme-map, "background2")
-
- border-radius: 16px
- margin-left: auto
- padding: 8px 16px
-
- cursor: pointer
-
- &:hover
- background-color: map.get($theme-map, "primary")
-
- span
- color: white
-
- svg
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- svg
- height: 12px
- width: 12px
-
- margin-left: 8px
-
- transform: rotate(90deg)
-
- @if $theme-name == dark
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- .select-active
- .selected-item
- background-color: map.get($theme-map, "primary")
-
- span
- color: white
-
- svg
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
-
- .select-options
- display: block
-
/* Buttons */
.button
diff --git a/src/sass/components/selectbox.sass b/src/sass/components/selectbox.sass
new file mode 100644
index 0000000..cb6d49c
--- /dev/null
+++ b/src/sass/components/selectbox.sass
@@ -0,0 +1,132 @@
+@use "sass:map"
+
+@mixin themable($theme-name, $theme-map)
+ body[theme=#{$theme-name}]
+ .select
+ display: inline-flex
+ align-items: center
+
+ font-size: larger
+
+ width: calc(100% - 24px)
+ height: 48px
+ padding: 0 12px
+
+ border-radius: 12px
+
+ .select-options
+ position: absolute
+ display: none
+
+ max-height: 230px
+ overflow: auto
+
+ background-color: map.get($theme-map, "select-boxes")
+ border-radius: 12px
+
+ box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
+
+ padding: 8px 12px
+ transform: translateY(calc(50% + 32px))
+
+ right: 32px
+
+ cursor: pointer
+
+ z-index: 1
+
+ @if $theme-name == dark
+ &::-webkit-scrollbar-track
+ background-color: map.get($theme-map, "background2")
+
+ &::-webkit-scrollbar-thumb
+ background: #d8dee9
+
+ &:hover
+ background: #e5e9f0
+
+ ul
+ list-style: none
+
+ padding: 0
+ margin: 0
+
+ li
+ color: #8592a3
+ font-size: smaller
+
+ border-radius: 8px
+
+ min-width: 120px
+ padding: 8px 12px
+
+ // margin-right: 8px
+
+ &:hover:not([disabled])
+ background-color: map.get($theme-map, "background2")
+ color: map.get($theme-map, "primary")
+
+ &[disabled]
+ display: block
+ color: #b2c0d3
+ cursor: default
+
+ li:not(:last-child)
+ margin-bottom: 4px
+
+ li.selected
+ background-color: map.get($theme-map, "background2")
+ color: map.get($theme-map, "primary")
+
+ .selected-item
+ display: flex
+ align-items: baseline
+
+ font-size: initial
+
+ background-color: map.get($theme-map, "background2")
+
+ border-radius: 16px
+ margin-left: auto
+ padding: 8px 16px
+
+ cursor: pointer
+
+ &:hover
+ background-color: map.get($theme-map, "primary")
+
+ span
+ color: white
+
+ img
+ filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
+
+ img
+ height: 12px
+ width: 12px
+
+ margin-left: 8px
+
+ transform: rotate(90deg)
+
+ @if $theme-name == dark
+ filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
+
+ .select-active
+ .selected-item
+ background-color: map.get($theme-map, "primary")
+
+ span
+ color: white
+
+ img
+ filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
+
+ .select-options
+ display: block
+
+@import "../themes/light"
+@import "../themes/dark"
+
+@include themable(light, $light)
+@include themable(dark, $dark)
diff --git a/src/ts/core/Locales.ts b/src/ts/core/Locales.ts
index d6cd7e1..8ace2c1 100644
--- a/src/ts/core/Locales.ts
+++ b/src/ts/core/Locales.ts
@@ -4,8 +4,8 @@ import constants from '../Constants';
import promisify from './promisify';
type AvailableLocales =
- | 'en'
- | 'ru';
+ | 'en-us'
+ | 'ru-ru';
declare const Neutralino;