Save locale
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-05-26 01:51:24 +03:00
parent 9d88c3e353
commit 6176c1c15a
5 changed files with 11 additions and 31 deletions

View File

@@ -7,11 +7,16 @@ export default () => {
const [t, { locale }] = useI18n(); const [t, { locale }] = useI18n();
const avaliableLocales = ['en', 'ru']; const avaliableLocales = ['en', 'ru'];
const preferredLocales = navigator.languages.map((lang) => lang.substring(0, 2)); const savedLocale = localStorage.getItem('locale');
for (const lang of preferredLocales) { if (savedLocale) {
if (avaliableLocales.includes(lang)) { locale(savedLocale);
locale(lang); } else {
break; const preferredLocales = navigator.languages.map((lang) => lang.substring(0, 2));
for (const lang of preferredLocales) {
if (avaliableLocales.includes(lang)) {
locale(lang);
break;
}
} }
} }
@@ -26,6 +31,7 @@ export default () => {
locale('ru') locale('ru')
break; break;
} }
localStorage.setItem('locale', locale());
}} }}
class={styles.LanguageSelector} class={styles.LanguageSelector}
> >

View File

@@ -6,21 +6,18 @@ export default () => {
<a <a
href='https://github.com/anatolykopyl' href='https://github.com/anatolykopyl'
target='_blank' target='_blank'
class='hover-grad'
> >
github github
</a> </a>
<a <a
href='https://www.linkedin.com/in/akopyl/' href='https://www.linkedin.com/in/akopyl/'
target='_blank' target='_blank'
class='hover-grad'
> >
linkedin linkedin
</a> </a>
<a <a
href='https://t.me/avkopyl' href='https://t.me/avkopyl'
target='_blank' target='_blank'
class='hover-grad'
> >
telegram telegram
</a> </a>

View File

@@ -18,7 +18,6 @@ export default (props: {project: Project}) => {
<a <a
href={props.project.link} href={props.project.link}
target="_blank" target="_blank"
class='hover-grad'
> >
<h2>{props.project.name}</h2> <h2>{props.project.name}</h2>
</a> </a>

View File

@@ -18,7 +18,6 @@ export default () => {
<div <div
use:observer={(event) => { use:observer={(event) => {
if (event.isIntersecting) { if (event.isIntersecting) {
console.log(chapterName);
if (!state.scrolling()) { if (!state.scrolling()) {
setters.setVisibleChapter(chapterName); setters.setVisibleChapter(chapterName);
} else if (state.visibleChapter() === chapterName) { } else if (state.visibleChapter() === chapterName) {

View File

@@ -69,24 +69,3 @@ textarea:focus, input:focus{
input::placeholder, textarea::placeholder { input::placeholder, textarea::placeholder {
color: var(--clr-text-secondary); color: var(--clr-text-secondary);
} }
.hover-grad {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab, var(--clr-text), var(--clr-text), var(--clr-text));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-size: 200% auto;
}
.hover-grad:hover {
animation: gradient 1s ease forwards;
animation-iteration-count: 1;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
100% {
background-position: 100% 50%;
}
}