mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Update text alignment to the left
This commit is contained in:
+48
-41
@@ -1,18 +1,18 @@
|
||||
import { FC, useEffect } from 'react';
|
||||
import { getBlogPostsSlugs, getBlogPostdata } from '../../lib/blog';
|
||||
import { useRouter } from 'next/router';
|
||||
import { MdxRemote } from 'next-mdx-remote/types';
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import { MDXEmbedProvider } from 'mdx-embed';
|
||||
import { GetStaticPaths, GetStaticProps } from 'next';
|
||||
import renderToString from 'next-mdx-remote/render-to-string';
|
||||
import hydrate from 'next-mdx-remote/hydrate';
|
||||
import styled from 'styled-components';
|
||||
import matter from 'gray-matter';
|
||||
import AllComponents from '../../components/All';
|
||||
import Head from 'next/head';
|
||||
import IconButton from '../../components/IconButton';
|
||||
import CodeBlock from '../../components/CodeBlock';
|
||||
import { FC, useEffect } from "react";
|
||||
import { getBlogPostsSlugs, getBlogPostdata } from "../../lib/blog";
|
||||
import { useRouter } from "next/router";
|
||||
import { MdxRemote } from "next-mdx-remote/types";
|
||||
import { MDXProvider } from "@mdx-js/react";
|
||||
import { MDXEmbedProvider } from "mdx-embed";
|
||||
import { GetStaticPaths, GetStaticProps } from "next";
|
||||
import renderToString from "next-mdx-remote/render-to-string";
|
||||
import hydrate from "next-mdx-remote/hydrate";
|
||||
import styled from "styled-components";
|
||||
import matter from "gray-matter";
|
||||
import AllComponents from "../../components/All";
|
||||
import Head from "next/head";
|
||||
import IconButton from "../../components/IconButton";
|
||||
import CodeBlock from "../../components/CodeBlock";
|
||||
|
||||
interface Props {
|
||||
source: MdxRemote.Source;
|
||||
@@ -31,8 +31,6 @@ const Wrapper = styled.div`
|
||||
}
|
||||
|
||||
.meta {
|
||||
text-align: center;
|
||||
|
||||
.back {
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
@@ -41,9 +39,16 @@ const Wrapper = styled.div`
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h1,
|
||||
p,
|
||||
.tags-wrapper {
|
||||
text-align: left;
|
||||
width: 85%;
|
||||
margin: 0.5rem auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
margin: 0.5rem 0rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
@@ -53,7 +58,6 @@ const Wrapper = styled.div`
|
||||
.tags-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
@@ -115,42 +119,45 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||
<meta name='author' content='Hazem Krimi' />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="author" content="Hazem Krimi" />
|
||||
<meta
|
||||
name='description'
|
||||
name="description"
|
||||
content={
|
||||
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='canonical' href='https://hazemkrimi.tech' />
|
||||
<meta property='og:image' content='/logo.jpg' />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="canonical" href="https://hazemkrimi.tech" />
|
||||
<meta property="og:image" content="/logo.jpg" />
|
||||
<meta
|
||||
property='og:description'
|
||||
property="og:description"
|
||||
content={
|
||||
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
|
||||
name='keywords'
|
||||
property="og:title"
|
||||
content={`${frontMatter.title} | Hazem Krimi`}
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content={
|
||||
frontMatter.tags
|
||||
? 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'
|
||||
? 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"
|
||||
}
|
||||
/>
|
||||
<title>{frontMatter.title} | Hazem Krimi</title>
|
||||
</Head>
|
||||
<Wrapper>
|
||||
<div className='meta'>
|
||||
<div className='back' onClick={() => router.back()}>
|
||||
<IconButton icon='/icons/arrow-left.svg' />
|
||||
<div className="meta">
|
||||
<div className="back" onClick={() => router.back()}>
|
||||
<IconButton icon="/icons/arrow-left.svg" />
|
||||
<span>Back</span>
|
||||
</div>
|
||||
<h1>{frontMatter.title}</h1>
|
||||
@@ -159,7 +166,7 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
||||
Written by <b>{frontMatter.author}</b> on <b>{frontMatter.date}</b>
|
||||
</p>
|
||||
{frontMatter.tags && (
|
||||
<div className='tags-wrapper'>
|
||||
<div className="tags-wrapper">
|
||||
{frontMatter.tags.map((tag: string, index: number) => (
|
||||
<span key={index}>#{tag} </span>
|
||||
))}
|
||||
@@ -169,7 +176,7 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
||||
</div>
|
||||
<MDXProvider components={{ code: CodeBlock }}>
|
||||
<MDXEmbedProvider>
|
||||
<div className='content'>{content}</div>
|
||||
<div className="content">{content}</div>
|
||||
</MDXEmbedProvider>
|
||||
</MDXProvider>
|
||||
</Wrapper>
|
||||
@@ -183,7 +190,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
||||
const paths = getBlogPostsSlugs();
|
||||
return {
|
||||
paths,
|
||||
fallback: false
|
||||
fallback: false,
|
||||
};
|
||||
};
|
||||
export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
||||
@@ -191,13 +198,13 @@ export const getStaticProps: GetStaticProps = async ({ params }: any) => {
|
||||
const { data, content } = matter(blogPostContent);
|
||||
const mdxSource = await renderToString(content, {
|
||||
components,
|
||||
scope: data
|
||||
scope: data,
|
||||
});
|
||||
|
||||
return {
|
||||
props: {
|
||||
source: mdxSource,
|
||||
frontMatter: data
|
||||
}
|
||||
frontMatter: data,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user