mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-02 02:10:27 +00:00
Rename lib folder to utils
This commit is contained in:
+37
-40
@@ -1,18 +1,18 @@
|
|||||||
import { FC, useEffect } from "react";
|
import { FC, useEffect } from 'react';
|
||||||
import { getBlogPostsSlugs, getBlogPostdata } from "../../lib/blog";
|
import { getBlogPostsSlugs, getBlogPostdata } from '../../utils/blog';
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from 'next/router';
|
||||||
import { MdxRemote } from "next-mdx-remote/types";
|
import { MdxRemote } from 'next-mdx-remote/types';
|
||||||
import { MDXProvider } from "@mdx-js/react";
|
import { MDXProvider } from '@mdx-js/react';
|
||||||
import { MDXEmbedProvider } from "mdx-embed";
|
import { MDXEmbedProvider } from 'mdx-embed';
|
||||||
import { GetStaticPaths, GetStaticProps } from "next";
|
import { GetStaticPaths, GetStaticProps } from 'next';
|
||||||
import renderToString from "next-mdx-remote/render-to-string";
|
import renderToString from 'next-mdx-remote/render-to-string';
|
||||||
import hydrate from "next-mdx-remote/hydrate";
|
import hydrate from 'next-mdx-remote/hydrate';
|
||||||
import styled from "styled-components";
|
import styled from 'styled-components';
|
||||||
import matter from "gray-matter";
|
import matter from 'gray-matter';
|
||||||
import AllComponents from "../../components/All";
|
import AllComponents from '../../components/All';
|
||||||
import Head from "next/head";
|
import Head from 'next/head';
|
||||||
import IconButton from "../../components/IconButton";
|
import IconButton from '../../components/IconButton';
|
||||||
import CodeBlock from "../../components/CodeBlock";
|
import CodeBlock from '../../components/CodeBlock';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
source: MdxRemote.Source;
|
source: MdxRemote.Source;
|
||||||
@@ -119,45 +119,42 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||||
<meta name="author" content="Hazem Krimi" />
|
<meta name='author' content='Hazem Krimi' />
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name='description'
|
||||||
content={
|
content={
|
||||||
frontMatter.description
|
frontMatter.description
|
||||||
? frontMatter.description
|
? frontMatter.description
|
||||||
: "Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast"
|
: 'Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon' />
|
||||||
<link rel="canonical" href="https://hazemkrimi.tech" />
|
<link rel='canonical' href='https://hazemkrimi.tech' />
|
||||||
<meta property="og:image" content="/logo.jpg" />
|
<meta property='og:image' content='/logo.jpg' />
|
||||||
<meta
|
<meta
|
||||||
property="og:description"
|
property='og:description'
|
||||||
content={
|
content={
|
||||||
frontMatter.description
|
frontMatter.description
|
||||||
? frontMatter.description
|
? frontMatter.description
|
||||||
: "Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast"
|
: 'Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<meta property='og:title' content={`${frontMatter.title} | Hazem Krimi`} />
|
||||||
<meta
|
<meta
|
||||||
property="og:title"
|
name='keywords'
|
||||||
content={`${frontMatter.title} | Hazem Krimi`}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="keywords"
|
|
||||||
content={
|
content={
|
||||||
frontMatter.tags
|
frontMatter.tags
|
||||||
? frontMatter.tags.join(" ")
|
? frontMatter.tags.join(' ')
|
||||||
: "Hazem, Krimi, Developer, Software, Engineer, Web, Mobile, Frontend, Backend, Fullstack, JavaScript, React.js, React Native, Node.js, Portfolio, Blog, Tutorials, Tech News"
|
: 'Hazem, Krimi, Developer, Software, Engineer, Web, Mobile, Frontend, Backend, Fullstack, JavaScript, React.js, React Native, Node.js, Portfolio, Blog, Tutorials, Tech News'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<title>{frontMatter.title} | Hazem Krimi</title>
|
<title>{frontMatter.title} | Hazem Krimi</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<div className="meta">
|
<div className='meta'>
|
||||||
<div className="back" onClick={() => router.back()}>
|
<div className='back' onClick={() => router.back()}>
|
||||||
<IconButton icon="/icons/arrow-left.svg" />
|
<IconButton icon='/icons/arrow-left.svg' />
|
||||||
<span>Back</span>
|
<span>Back</span>
|
||||||
</div>
|
</div>
|
||||||
<h1>{frontMatter.title}</h1>
|
<h1>{frontMatter.title}</h1>
|
||||||
@@ -166,7 +163,7 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
Written by <b>{frontMatter.author}</b> on <b>{frontMatter.date}</b>
|
Written by <b>{frontMatter.author}</b> on <b>{frontMatter.date}</b>
|
||||||
</p>
|
</p>
|
||||||
{frontMatter.tags && (
|
{frontMatter.tags && (
|
||||||
<div className="tags-wrapper">
|
<div className='tags-wrapper'>
|
||||||
{frontMatter.tags.map((tag: string, index: number) => (
|
{frontMatter.tags.map((tag: string, index: number) => (
|
||||||
<span key={index}>#{tag} </span>
|
<span key={index}>#{tag} </span>
|
||||||
))}
|
))}
|
||||||
@@ -176,7 +173,7 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
</div>
|
</div>
|
||||||
<MDXProvider components={{ code: CodeBlock }}>
|
<MDXProvider components={{ code: CodeBlock }}>
|
||||||
<MDXEmbedProvider>
|
<MDXEmbedProvider>
|
||||||
<div className="content">{content}</div>
|
<div className='content'>{content}</div>
|
||||||
</MDXEmbedProvider>
|
</MDXEmbedProvider>
|
||||||
</MDXProvider>
|
</MDXProvider>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
@@ -190,7 +187,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
|||||||
const paths = getBlogPostsSlugs();
|
const paths = getBlogPostsSlugs();
|
||||||
return {
|
return {
|
||||||
paths,
|
paths,
|
||||||
fallback: false,
|
fallback: false
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
||||||
@@ -198,13 +195,13 @@ export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
|||||||
const { data, content } = matter(blogPostContent);
|
const { data, content } = matter(blogPostContent);
|
||||||
const mdxSource = await renderToString(content, {
|
const mdxSource = await renderToString(content, {
|
||||||
components,
|
components,
|
||||||
scope: data,
|
scope: data
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
source: mdxSource,
|
source: mdxSource,
|
||||||
frontMatter: data,
|
frontMatter: data
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { getBlogPosts } from '../../lib/blog';
|
import { getBlogPosts } from '../../utils/blog';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Card from '../../components/Card';
|
import Card from '../../components/Card';
|
||||||
import IconButton from '../../components/IconButton';
|
import IconButton from '../../components/IconButton';
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { getPortfolioProjects } from '../lib/portfolio';
|
import { getPortfolioProjects } from '../utils/portfolio';
|
||||||
import { getBlogPosts } from '../lib/blog';
|
import { getBlogPosts } from '../utils/blog';
|
||||||
import { GetStaticProps } from 'next';
|
import { GetStaticProps } from 'next';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Hero from '../components/Hero';
|
import Hero from '../components/Hero';
|
||||||
|
|||||||
+36
-42
@@ -1,21 +1,18 @@
|
|||||||
import { FC, useEffect } from "react";
|
import { FC, useEffect } from 'react';
|
||||||
import {
|
import { getPortfolioPorjectsSlugs, getPortfolioProjectdata } from '../../utils/portfolio';
|
||||||
getPortfolioPorjectsSlugs,
|
import { useRouter } from 'next/router';
|
||||||
getPortfolioProjectdata,
|
import { MdxRemote } from 'next-mdx-remote/types';
|
||||||
} from "../../lib/portfolio";
|
import { MDXProvider } from '@mdx-js/react';
|
||||||
import { useRouter } from "next/router";
|
import { MDXEmbedProvider } from 'mdx-embed';
|
||||||
import { MdxRemote } from "next-mdx-remote/types";
|
import { GetStaticPaths, GetStaticProps } from 'next';
|
||||||
import { MDXProvider } from "@mdx-js/react";
|
import renderToString from 'next-mdx-remote/render-to-string';
|
||||||
import { MDXEmbedProvider } from "mdx-embed";
|
import hydrate from 'next-mdx-remote/hydrate';
|
||||||
import { GetStaticPaths, GetStaticProps } from "next";
|
import styled from 'styled-components';
|
||||||
import renderToString from "next-mdx-remote/render-to-string";
|
import matter from 'gray-matter';
|
||||||
import hydrate from "next-mdx-remote/hydrate";
|
import AllComponents from '../../components/All';
|
||||||
import styled from "styled-components";
|
import Head from 'next/head';
|
||||||
import matter from "gray-matter";
|
import IconButton from '../../components/IconButton';
|
||||||
import AllComponents from "../../components/All";
|
import CodeBlock from '../../components/CodeBlock';
|
||||||
import Head from "next/head";
|
|
||||||
import IconButton from "../../components/IconButton";
|
|
||||||
import CodeBlock from "../../components/CodeBlock";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
source: MdxRemote.Source;
|
source: MdxRemote.Source;
|
||||||
@@ -113,47 +110,44 @@ const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||||
<meta name="author" content="Hazem Krimi" />
|
<meta name='author' content='Hazem Krimi' />
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name='description'
|
||||||
content={
|
content={
|
||||||
frontMatter.description
|
frontMatter.description
|
||||||
? frontMatter.description
|
? frontMatter.description
|
||||||
: "Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast"
|
: 'Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon' />
|
||||||
<link rel="canonical" href="https://hazemkrimi.tech" />
|
<link rel='canonical' href='https://hazemkrimi.tech' />
|
||||||
<meta property="og:image" content="/logo.jpg" />
|
<meta property='og:image' content='/logo.jpg' />
|
||||||
<meta
|
<meta
|
||||||
property="og:description"
|
property='og:description'
|
||||||
content={
|
content={
|
||||||
frontMatter.description
|
frontMatter.description
|
||||||
? frontMatter.description
|
? frontMatter.description
|
||||||
: "Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast"
|
: 'Hazem Krimi is a Full Stack JavaScript Developer and a Software Engineering Enthusiast'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<meta property='og:title' content={`${frontMatter.title} | Hazem Krimi`} />
|
||||||
<meta
|
<meta
|
||||||
property="og:title"
|
name='keywords'
|
||||||
content={`${frontMatter.title} | Hazem Krimi`}
|
content='Hazem, Krimi, Developer, Software, Engineer, Web, Mobile, Frontend, Backend, Fullstack, JavaScript, React.js, React Native, Node.js, Portfolio, Blog, Tutorials, Tech News'
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="keywords"
|
|
||||||
content="Hazem, Krimi, Developer, Software, Engineer, Web, Mobile, Frontend, Backend, Fullstack, JavaScript, React.js, React Native, Node.js, Portfolio, Blog, Tutorials, Tech News"
|
|
||||||
/>
|
/>
|
||||||
<title>{frontMatter.title} | Hazem Krimi</title>
|
<title>{frontMatter.title} | Hazem Krimi</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<div className="meta">
|
<div className='meta'>
|
||||||
<div className="back" onClick={() => router.back()}>
|
<div className='back' onClick={() => router.back()}>
|
||||||
<IconButton icon="/icons/arrow-left.svg" />
|
<IconButton icon='/icons/arrow-left.svg' />
|
||||||
<span>Back</span>
|
<span>Back</span>
|
||||||
</div>
|
</div>
|
||||||
<h1>{frontMatter.title}</h1>
|
<h1>{frontMatter.title}</h1>
|
||||||
<p>{frontMatter.description}</p>
|
<p>{frontMatter.description}</p>
|
||||||
{frontMatter.tags && (
|
{frontMatter.tags && (
|
||||||
<div className="tags-wrapper">
|
<div className='tags-wrapper'>
|
||||||
{frontMatter.tags.map((tag: string, index: number) => (
|
{frontMatter.tags.map((tag: string, index: number) => (
|
||||||
<span key={index}>#{tag} </span>
|
<span key={index}>#{tag} </span>
|
||||||
))}
|
))}
|
||||||
@@ -163,7 +157,7 @@ const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
</div>
|
</div>
|
||||||
<MDXProvider components={{ code: CodeBlock }}>
|
<MDXProvider components={{ code: CodeBlock }}>
|
||||||
<MDXEmbedProvider>
|
<MDXEmbedProvider>
|
||||||
<div className="content">{content}</div>
|
<div className='content'>{content}</div>
|
||||||
</MDXEmbedProvider>
|
</MDXEmbedProvider>
|
||||||
</MDXProvider>
|
</MDXProvider>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
@@ -177,7 +171,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
|||||||
const paths = getPortfolioPorjectsSlugs();
|
const paths = getPortfolioPorjectsSlugs();
|
||||||
return {
|
return {
|
||||||
paths,
|
paths,
|
||||||
fallback: false,
|
fallback: false
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
||||||
@@ -185,13 +179,13 @@ export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
|||||||
const { data, content } = matter(blogPostContent);
|
const { data, content } = matter(blogPostContent);
|
||||||
const mdxSource = await renderToString(content, {
|
const mdxSource = await renderToString(content, {
|
||||||
components,
|
components,
|
||||||
scope: data,
|
scope: data
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
source: mdxSource,
|
source: mdxSource,
|
||||||
frontMatter: data,
|
frontMatter: data
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { getPortfolioProjects } from '../../lib/portfolio';
|
import { getPortfolioProjects } from '../../utils/portfolio';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Card from '../../components/Card';
|
import Card from '../../components/Card';
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export const getPortfolioProjects = () => {
|
|||||||
const { data } = matter(fileContents);
|
const { data } = matter(fileContents);
|
||||||
|
|
||||||
const options = { month: 'long', day: 'numeric', year: 'numeric' };
|
const options = { month: 'long', day: 'numeric', year: 'numeric' };
|
||||||
|
// @ts-ignore
|
||||||
const formattedDate = new Date(data.date).toLocaleDateString('en-IN', options);
|
const formattedDate = new Date(data.date).toLocaleDateString('en-IN', options);
|
||||||
|
|
||||||
const frontmatter = {
|
const frontmatter = {
|
||||||
Reference in New Issue
Block a user