mirror of
https://github.com/sergeyyarkov/yarkov.tech.git
synced 2026-10-11 10:29:21 +03:00
format
This commit is contained in:
parent
fe8e960b87
commit
fbb047e8b7
@ -3,11 +3,7 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"es2021": true
|
"es2021": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:solid/typescript"],
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:solid/typescript"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": "latest",
|
"ecmaVersion": "latest",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 100,
|
"printWidth": 120,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": false,
|
"singleQuote": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
|
|||||||
@ -15,9 +15,7 @@ window.theme = (() => {
|
|||||||
document.documentElement.setAttribute("data-theme", window.theme);
|
document.documentElement.setAttribute("data-theme", window.theme);
|
||||||
|
|
||||||
/* Sync with OS theme */
|
/* Sync with OS theme */
|
||||||
window
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches: isDark }) => {
|
||||||
.matchMedia("(prefers-color-scheme: dark)")
|
|
||||||
.addEventListener("change", ({ matches: isDark }) => {
|
|
||||||
window.theme = isDark ? "dark" : "light";
|
window.theme = isDark ? "dark" : "light";
|
||||||
localStorage.setItem("theme", window.theme);
|
localStorage.setItem("theme", window.theme);
|
||||||
document.documentElement.setAttribute("data-theme", window.theme);
|
document.documentElement.setAttribute("data-theme", window.theme);
|
||||||
|
|||||||
@ -42,9 +42,7 @@ if (window.theme) {
|
|||||||
$head.appendChild($dark);
|
$head.appendChild($dark);
|
||||||
|
|
||||||
window.addEventListener("onthemetoggled", ({ detail: newTheme }) => toggleMedia(newTheme));
|
window.addEventListener("onthemetoggled", ({ detail: newTheme }) => toggleMedia(newTheme));
|
||||||
window
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches: isDark }) => {
|
||||||
.matchMedia("(prefers-color-scheme: dark)")
|
|
||||||
.addEventListener("change", ({ matches: isDark }) => {
|
|
||||||
return isDark ? toggleMedia("dark") : toggleMedia("light");
|
return isDark ? toggleMedia("dark") : toggleMedia("light");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,9 +15,9 @@ export const ArticleItem: Component<ArticleItemProps> = (props) => {
|
|||||||
return (
|
return (
|
||||||
<article class="article-item">
|
<article class="article-item">
|
||||||
<a
|
<a
|
||||||
href={`${hrefLangPrefix}/blog/${new Date(props.data.published_at).toLocaleDateString(
|
href={`${hrefLangPrefix}/blog/${new Date(props.data.published_at).toLocaleDateString("en-CA")}/${
|
||||||
"en-CA"
|
props.data.slug
|
||||||
)}/${props.data.slug}/`}
|
}/`}
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<h3>{props.data.title}</h3>
|
<h3>{props.data.title}</h3>
|
||||||
|
|||||||
@ -4,25 +4,13 @@ import { createSignal, createEffect } from "solid-js";
|
|||||||
import "./NavToggle.scss";
|
import "./NavToggle.scss";
|
||||||
|
|
||||||
const MenuIcon: Component = () => (
|
const MenuIcon: Component = () => (
|
||||||
<svg
|
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="24px" height="24px">
|
||||||
fill="#000000"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 50 50"
|
|
||||||
width="24px"
|
|
||||||
height="24px"
|
|
||||||
>
|
|
||||||
<path d="M 0 7.5 L 0 12.5 L 50 12.5 L 50 7.5 Z M 0 22.5 L 0 27.5 L 50 27.5 L 50 22.5 Z M 0 37.5 L 0 42.5 L 50 42.5 L 50 37.5 Z" />
|
<path d="M 0 7.5 L 0 12.5 L 50 12.5 L 50 7.5 Z M 0 22.5 L 0 27.5 L 50 27.5 L 50 22.5 Z M 0 37.5 L 0 42.5 L 50 42.5 L 50 37.5 Z" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
const CloseIcon: Component = () => (
|
const CloseIcon: Component = () => (
|
||||||
<svg
|
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="24px" height="24px">
|
||||||
fill="#000000"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 50 50"
|
|
||||||
width="24px"
|
|
||||||
height="24px"
|
|
||||||
>
|
|
||||||
<path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z" />
|
<path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
@ -44,13 +32,7 @@ const NavToggle: Component = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button class="nav-toggle" onClick={toggleNav} type="button" aria-pressed={isNavShown()} aria-label="Menu">
|
||||||
class="nav-toggle"
|
|
||||||
onClick={toggleNav}
|
|
||||||
type="button"
|
|
||||||
aria-pressed={isNavShown()}
|
|
||||||
aria-label="Menu"
|
|
||||||
>
|
|
||||||
{isNavShown() ? <CloseIcon /> : <MenuIcon />}
|
{isNavShown() ? <CloseIcon /> : <MenuIcon />}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -54,13 +54,7 @@ const SearchInput: Component<SearchInputProps> = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="search-input">
|
<div class="search-input">
|
||||||
<svg
|
<svg width="25" height="24" viewBox="0 0 25 24" xmlns="http://www.w3.org/2000/svg" data-filter="none">
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
data-filter="none"
|
|
||||||
>
|
|
||||||
<path d="M10.6026 3.60001C11.8798 3.59993 13.1316 3.94283 14.2172 4.5901C15.3028 5.23736 16.179 6.16331 16.7472 7.26368C17.3154 8.36405 17.5531 9.59517 17.4334 10.8184C17.3137 12.0417 16.8415 13.2085 16.0699 14.1876L21.2427 19.164C21.4085 19.3248 21.5053 19.5399 21.5135 19.7662C21.5218 19.9926 21.4411 20.2137 21.2874 20.3853C21.1337 20.5569 20.9184 20.6665 20.6845 20.6921C20.4505 20.7178 20.2151 20.6576 20.0253 20.5236L19.9205 20.436L14.7476 15.4596C13.8802 16.0922 12.8687 16.5172 11.7968 16.6994C10.7248 16.8815 9.62324 16.8157 8.58298 16.5074C7.54272 16.199 6.59366 15.6569 5.81422 14.9259C5.03478 14.1949 4.44733 13.296 4.10042 12.3034C3.7535 11.3108 3.65708 10.2531 3.81911 9.21757C3.98114 8.18204 4.39698 7.19847 5.03226 6.34812C5.66755 5.49778 6.50404 4.80506 7.47263 4.32721C8.44122 3.84936 9.51411 3.60009 10.6026 3.60001V3.60001ZM10.6026 5.40001C9.27934 5.40001 8.01025 5.90572 7.07454 6.80589C6.13884 7.70607 5.61316 8.92697 5.61316 10.2C5.61316 11.473 6.13884 12.6939 7.07454 13.5941C8.01025 14.4943 9.27934 15 10.6026 15C11.9259 15 13.195 14.4943 14.1307 13.5941C15.0664 12.6939 15.5921 11.473 15.5921 10.2C15.5921 8.92697 15.0664 7.70607 14.1307 6.80589C13.195 5.90572 11.9259 5.40001 10.6026 5.40001Z" />
|
<path d="M10.6026 3.60001C11.8798 3.59993 13.1316 3.94283 14.2172 4.5901C15.3028 5.23736 16.179 6.16331 16.7472 7.26368C17.3154 8.36405 17.5531 9.59517 17.4334 10.8184C17.3137 12.0417 16.8415 13.2085 16.0699 14.1876L21.2427 19.164C21.4085 19.3248 21.5053 19.5399 21.5135 19.7662C21.5218 19.9926 21.4411 20.2137 21.2874 20.3853C21.1337 20.5569 20.9184 20.6665 20.6845 20.6921C20.4505 20.7178 20.2151 20.6576 20.0253 20.5236L19.9205 20.436L14.7476 15.4596C13.8802 16.0922 12.8687 16.5172 11.7968 16.6994C10.7248 16.8815 9.62324 16.8157 8.58298 16.5074C7.54272 16.199 6.59366 15.6569 5.81422 14.9259C5.03478 14.1949 4.44733 13.296 4.10042 12.3034C3.7535 11.3108 3.65708 10.2531 3.81911 9.21757C3.98114 8.18204 4.39698 7.19847 5.03226 6.34812C5.66755 5.49778 6.50404 4.80506 7.47263 4.32721C8.44122 3.84936 9.51411 3.60009 10.6026 3.60001V3.60001ZM10.6026 5.40001C9.27934 5.40001 8.01025 5.90572 7.07454 6.80589C6.13884 7.70607 5.61316 8.92697 5.61316 10.2C5.61316 11.473 6.13884 12.6939 7.07454 13.5941C8.01025 14.4943 9.27934 15 10.6026 15C11.9259 15 13.195 14.4943 14.1307 13.5941C15.0664 12.6939 15.5921 11.473 15.5921 10.2C15.5921 8.92697 15.0664 7.70607 14.1307 6.80589C13.195 5.90572 11.9259 5.40001 10.6026 5.40001Z" />
|
||||||
</svg>
|
</svg>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@ -86,12 +86,7 @@ const TagsList: Component<TagsListProps> = (props) => {
|
|||||||
<For
|
<For
|
||||||
each={props.data}
|
each={props.data}
|
||||||
children={(tag) => (
|
children={(tag) => (
|
||||||
<li
|
<li onClick={onSelect} class="btn-link" data-tag={tag.toLocaleLowerCase()} data-active={isTagSelected(tag)}>
|
||||||
onClick={onSelect}
|
|
||||||
class="btn-link"
|
|
||||||
data-tag={tag.toLocaleLowerCase()}
|
|
||||||
data-active={isTagSelected(tag)}
|
|
||||||
>
|
|
||||||
{tag}
|
{tag}
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -43,9 +43,7 @@ const ThemeSwitcher: Component = () => {
|
|||||||
if (window.theme) {
|
if (window.theme) {
|
||||||
setTheme(window.theme);
|
setTheme(window.theme);
|
||||||
/* Update theme state on changing OS theme */
|
/* Update theme state on changing OS theme */
|
||||||
window
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches: isDark }) => {
|
||||||
.matchMedia("(prefers-color-scheme: dark)")
|
|
||||||
.addEventListener("change", ({ matches: isDark }) => {
|
|
||||||
const theme = isDark ? "dark" : "light";
|
const theme = isDark ? "dark" : "light";
|
||||||
setTheme(theme);
|
setTheme(theme);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
export const DEFAULT_LANGUAGE: LanguageKeys = "ru";
|
export const DEFAULT_LANGUAGE: LanguageKeys = "ru";
|
||||||
|
|
||||||
/* Show banner about website development */
|
/* Show banner about website development */
|
||||||
export const IS_SITE_UNDER_CONSTRUCTION =
|
export const IS_SITE_UNDER_CONSTRUCTION = import.meta.env.IS_SITE_UNDER_CONSTRUCTION === "true" ? true : false;
|
||||||
import.meta.env.IS_SITE_UNDER_CONSTRUCTION === "true" ? true : false;
|
|
||||||
|
|
||||||
export const SITE_METADATA: SiteMetadataType = {
|
export const SITE_METADATA: SiteMetadataType = {
|
||||||
title: "Sergey Yarkov",
|
title: "Sergey Yarkov",
|
||||||
@ -15,10 +14,19 @@ export const SITE_METADATA: SiteMetadataType = {
|
|||||||
telegramUrl: "https://t.me/sergeyyarkov",
|
telegramUrl: "https://t.me/sergeyyarkov",
|
||||||
},
|
},
|
||||||
nav: [
|
nav: [
|
||||||
{ key: "navigation.articles", url: "/articles/" },
|
{
|
||||||
{ key: "navigation.projects", url: "/projects/" },
|
key: "navigation.articles",
|
||||||
|
url: "/articles/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "navigation.projects",
|
||||||
|
url: "/projects/",
|
||||||
|
},
|
||||||
{ key: "navigation.about", url: "/about/" },
|
{ key: "navigation.about", url: "/about/" },
|
||||||
{ key: "navigation.contacts", url: "/contacts/" },
|
{
|
||||||
|
key: "navigation.contacts",
|
||||||
|
url: "/contacts/",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
@ -113,11 +121,20 @@ export const SITE_METADATA: SiteMetadataType = {
|
|||||||
en: "Programming",
|
en: "Programming",
|
||||||
},
|
},
|
||||||
list: [
|
list: [
|
||||||
{ icon: "nodejs", name: "Javascript/Typescript" },
|
{
|
||||||
{ icon: "language-c", name: "C Language" },
|
icon: "nodejs",
|
||||||
|
name: "Javascript/Typescript",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "language-c",
|
||||||
|
name: "C Language",
|
||||||
|
},
|
||||||
{ icon: "mysql", name: "SQL" },
|
{ icon: "mysql", name: "SQL" },
|
||||||
{ icon: "graphql", name: "GraphQL" },
|
{ icon: "graphql", name: "GraphQL" },
|
||||||
{ icon: "avr", name: "AVR instruction set" },
|
{
|
||||||
|
icon: "avr",
|
||||||
|
name: "AVR instruction set",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -142,7 +159,10 @@ export const SITE_METADATA: SiteMetadataType = {
|
|||||||
list: [
|
list: [
|
||||||
{ icon: "nodejs", name: "Node.js" },
|
{ icon: "nodejs", name: "Node.js" },
|
||||||
{ icon: "docker", name: "Docker" },
|
{ icon: "docker", name: "Docker" },
|
||||||
{ icon: "git-branch", name: "Git/gitflow" },
|
{
|
||||||
|
icon: "git-branch",
|
||||||
|
name: "Git/gitflow",
|
||||||
|
},
|
||||||
{ icon: "sass", name: "SASS" },
|
{ icon: "sass", name: "SASS" },
|
||||||
{ icon: "webpack", name: "Webpack" },
|
{ icon: "webpack", name: "Webpack" },
|
||||||
{ icon: "vite", name: "Vite.js" },
|
{ icon: "vite", name: "Vite.js" },
|
||||||
@ -154,7 +174,10 @@ export const SITE_METADATA: SiteMetadataType = {
|
|||||||
en: "Databases",
|
en: "Databases",
|
||||||
},
|
},
|
||||||
list: [
|
list: [
|
||||||
{ icon: "postgresql", name: "PostgreSQL" },
|
{
|
||||||
|
icon: "postgresql",
|
||||||
|
name: "PostgreSQL",
|
||||||
|
},
|
||||||
{ icon: "mongodb", name: "MongoDB" },
|
{ icon: "mongodb", name: "MongoDB" },
|
||||||
{ icon: "redis", name: "Redis" },
|
{ icon: "redis", name: "Redis" },
|
||||||
],
|
],
|
||||||
|
|||||||
@ -15,8 +15,7 @@ export default {
|
|||||||
/* Page descriptions */
|
/* Page descriptions */
|
||||||
"pageDescription.articles":
|
"pageDescription.articles":
|
||||||
"Technical articles, tutorials and various reference materials related to IT topics can be found here.",
|
"Technical articles, tutorials and various reference materials related to IT topics can be found here.",
|
||||||
"pageDescription.projects":
|
"pageDescription.projects": "A few of my main projects that have been developed and published in open access.",
|
||||||
"A few of my main projects that have been developed and published in open access.",
|
|
||||||
"pageDescription.contacts": "Use the feedback form or write to me on social networks.",
|
"pageDescription.contacts": "Use the feedback form or write to me on social networks.",
|
||||||
/* Navigation */
|
/* Navigation */
|
||||||
"navigation.articles": "Articles",
|
"navigation.articles": "Articles",
|
||||||
|
|||||||
@ -15,10 +15,8 @@ export default {
|
|||||||
/* Page descriptions */
|
/* Page descriptions */
|
||||||
"pageDescription.articles":
|
"pageDescription.articles":
|
||||||
"Технические статьи, туториалы и различные справочные материалы которые связаны с IT тематикой находятся здесь.",
|
"Технические статьи, туториалы и различные справочные материалы которые связаны с IT тематикой находятся здесь.",
|
||||||
"pageDescription.projects":
|
"pageDescription.projects": "Несколько моих основных проектов которые были разработаны и выложены в открытый доступ.",
|
||||||
"Несколько моих основных проектов которые были разработаны и выложены в открытый доступ.",
|
"pageDescription.contacts": "Воспользуйтесь формой обратной связи или напишите мне в социальные сети.",
|
||||||
"pageDescription.contacts":
|
|
||||||
"Воспользуйтесь формой обратной связи или напишите мне в социальные сети.",
|
|
||||||
/* Navigation */
|
/* Navigation */
|
||||||
"navigation.articles": "Статьи",
|
"navigation.articles": "Статьи",
|
||||||
"navigation.projects": "Проекты",
|
"navigation.projects": "Проекты",
|
||||||
|
|||||||
@ -3,14 +3,9 @@ import * as utils from "@utils/url";
|
|||||||
import { DEFAULT_LANGUAGE } from "@root/config";
|
import { DEFAULT_LANGUAGE } from "@root/config";
|
||||||
import languages from "./languages";
|
import languages from "./languages";
|
||||||
|
|
||||||
type TranslatedArticlesType = Record<
|
type TranslatedArticlesType = Record<string, Record<LanguageKeys, MDXInstance<ArticleType>> | Record<string, never>>;
|
||||||
string,
|
|
||||||
Record<LanguageKeys, MDXInstance<ArticleType>> | Record<string, never>
|
|
||||||
>;
|
|
||||||
|
|
||||||
export function formatArticlesByLangs(
|
export function formatArticlesByLangs(data: Record<string, MDXInstance<ArticleType>>): TranslatedArticlesType {
|
||||||
data: Record<string, MDXInstance<ArticleType>>
|
|
||||||
): TranslatedArticlesType {
|
|
||||||
const modules: TranslatedArticlesType = {};
|
const modules: TranslatedArticlesType = {};
|
||||||
|
|
||||||
for (const module of Object.values(data)) {
|
for (const module of Object.values(data)) {
|
||||||
@ -38,20 +33,15 @@ function transformExports<T>(modules: Record<string, { default: T }>) {
|
|||||||
return translations;
|
return translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
const translations = transformExports<UIDictionaryKeys>(
|
const translations = transformExports<UIDictionaryKeys>(import.meta.glob("./*/ui.ts", { eager: true }));
|
||||||
import.meta.glob("./*/ui.ts", { eager: true })
|
|
||||||
);
|
|
||||||
|
|
||||||
export function translate(key: UIDictionaryKeys, lang: LanguageKeys): string | undefined {
|
export function translate(key: UIDictionaryKeys, lang: LanguageKeys): string | undefined {
|
||||||
const string: string | undefined =
|
const string: string | undefined = translations[lang]?.[key] || translations[DEFAULT_LANGUAGE][key];
|
||||||
translations[lang]?.[key] || translations[DEFAULT_LANGUAGE][key];
|
|
||||||
if (string === undefined) console.log(`Cannot find any string for translation key "${key}".`);
|
if (string === undefined) console.log(`Cannot find any string for translation key "${key}".`);
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useTranslation(
|
export function useTranslation(Astro: Readonly<AstroGlobal>): (key: UIDictionaryKeys) => string | undefined {
|
||||||
Astro: Readonly<AstroGlobal>
|
|
||||||
): (key: UIDictionaryKeys) => string | undefined {
|
|
||||||
const lang: LanguageKeys = utils.getLanguageFromURL(Astro.url.pathname) as LanguageKeys;
|
const lang: LanguageKeys = utils.getLanguageFromURL(Astro.url.pathname) as LanguageKeys;
|
||||||
return (key: UIDictionaryKeys) => translate(key, lang);
|
return (key: UIDictionaryKeys) => translate(key, lang);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,7 @@ for (const key of Object.keys(articles)) {
|
|||||||
new Date(published_at).toLocaleDateString("en-CA") +
|
new Date(published_at).toLocaleDateString("en-CA") +
|
||||||
`/${slug}/`,
|
`/${slug}/`,
|
||||||
title,
|
title,
|
||||||
description: `${description}${
|
description: `${description}${coverImage !== undefined ? `<img src="${coverImage}" alt="${title}">` : ""}`,
|
||||||
coverImage !== undefined ? `<img src="${coverImage}" alt="${title}">` : ""
|
|
||||||
}`,
|
|
||||||
pubDate: published_at,
|
pubDate: published_at,
|
||||||
customData: `<language>${lang}</language>`,
|
customData: `<language>${lang}</language>`,
|
||||||
});
|
});
|
||||||
|
|||||||
10
src/types/main.d.ts
vendored
10
src/types/main.d.ts
vendored
@ -28,7 +28,10 @@ declare global {
|
|||||||
githubUrl: string;
|
githubUrl: string;
|
||||||
telegramUrl: string;
|
telegramUrl: string;
|
||||||
};
|
};
|
||||||
nav: Array<{ key: UIDictionaryKeys; url: string }>;
|
nav: Array<{
|
||||||
|
key: UIDictionaryKeys;
|
||||||
|
url: string;
|
||||||
|
}>;
|
||||||
projects: Array<ProjectType>;
|
projects: Array<ProjectType>;
|
||||||
skills: Array<SkillsType>;
|
skills: Array<SkillsType>;
|
||||||
};
|
};
|
||||||
@ -57,7 +60,10 @@ declare global {
|
|||||||
|
|
||||||
type SkillsType = {
|
type SkillsType = {
|
||||||
title: Record<LanguageKeys, string>;
|
title: Record<LanguageKeys, string>;
|
||||||
list: Array<{ icon?: string | undefined; name: string }>;
|
list: Array<{
|
||||||
|
icon?: string | undefined;
|
||||||
|
name: string;
|
||||||
|
}>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ContactFieldsType = {
|
type ContactFieldsType = {
|
||||||
|
|||||||
@ -12,9 +12,7 @@ export const transformArticles = (articles: MDXInstance<ArticleType>[]): Article
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
export const sortArtcilesByDate = (articles: ArticleType[]): ArticleType[] => {
|
export const sortArtcilesByDate = (articles: ArticleType[]): ArticleType[] => {
|
||||||
return articles.sort(
|
return articles.sort((a, b) => new Date(b.published_at).valueOf() - new Date(a.published_at).valueOf());
|
||||||
(a, b) => new Date(b.published_at).valueOf() - new Date(a.published_at).valueOf()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,10 +31,7 @@ export const formatToArticleBlocks = (articles: ArticleType[]): ArticleBlockType
|
|||||||
return blocks;
|
return blocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const findArticlesBySearch = (
|
export const findArticlesBySearch = (search: string, articles: ArticleBlockType): ArticleBlockType => {
|
||||||
search: string,
|
|
||||||
articles: ArticleBlockType
|
|
||||||
): ArticleBlockType => {
|
|
||||||
const matched: Array<ArticleType> = [];
|
const matched: Array<ArticleType> = [];
|
||||||
|
|
||||||
search = search.toLocaleLowerCase();
|
search = search.toLocaleLowerCase();
|
||||||
@ -54,10 +49,7 @@ export const findArticlesBySearch = (
|
|||||||
return formatToArticleBlocks(matched);
|
return formatToArticleBlocks(matched);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const findArticlesByTags = (
|
export const findArticlesByTags = (tags: string[], articles: ArticleBlockType): ArticleBlockType => {
|
||||||
tags: string[],
|
|
||||||
articles: ArticleBlockType
|
|
||||||
): ArticleBlockType => {
|
|
||||||
const matched: Array<ArticleType> = [];
|
const matched: Array<ArticleType> = [];
|
||||||
|
|
||||||
for (const year in articles) {
|
for (const year in articles) {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export function isEmail(email: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isURL(url: string): boolean {
|
export function isURL(url: string): boolean {
|
||||||
return new RegExp(
|
return new RegExp(/(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\\/~+#-]*[\w@?^=%&\\/~+#-])/).test(
|
||||||
/(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\\/~+#-]*[\w@?^=%&\\/~+#-])/
|
url
|
||||||
).test(url);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user