Skip to content

Commit

Permalink
refactor(about): separate about config with components
Browse files Browse the repository at this point in the history
  • Loading branch information
1chooo committed Jul 13, 2024
1 parent 2a9b7e7 commit 7a6b7ee
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 38 deletions.
27 changes: 19 additions & 8 deletions src/components/About/AboutText.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import {
messages
} from '../../config/About/AboutData';
import React from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import Anchor from '../Anchor';

import { abouts } from '../../config/about';

const AboutText: React.FC = () => {
const { subHeader, description } = abouts;

const renderDescription = () =>
description.map((item, index) => (
<ReactMarkdown
key={index}
children={item}
remarkPlugins={[remarkGfm]}
components={{ a: ({ node, ...props }) => <Anchor {...props} /> }}
/>
));

return (
<section className="about-text">
<p>
<h3><code> $ ls -al Hugo 👨🏻‍💻 (He/Him)</code></h3>
<h3><code>{subHeader}</code></h3>
</p>

{messages.map((message: JSX.Element) => message)}

{renderDescription()}
</section>
);
}
};

export default AboutText;
28 changes: 0 additions & 28 deletions src/config/About/AboutData.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions src/config/about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import IAbout from '../interface/IAbout';


export const abouts: IAbout = {
"header": "About Hugo 👨🏻‍💻",
"subHeader": "$ ls -al Hugo 👨🏻‍💻 (He/Him)",
"pronouns": "He/Him",
"description": [
"I'm **Hugo ChunHo Lin**, a 4th-year student at [National Central University 🐿️](https://www.ncu.edu.tw/), fueled by a ***sincere passion*** for the field of **Software Engineering 💻.**",
"*I do **Web Development and Cloud Development** with a focus on **creating APIs and handling backend tasks** using `FastAPI, Gin, and AWS`. In general, I define new problems and find existing problems, transforming solutions into helpful documents or articles to assist everyone in the process, and eventually apply them to make social impacts.*",
"In my spare time, I do *street photography 📷* and *consistently share my findings on GitHub with Global 🌏*.",
],
}
8 changes: 8 additions & 0 deletions src/interface/IAbout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface IAbout {
header: string;
subHeader: string;
pronouns: string;
description: string[];
}

export default IAbout;
4 changes: 2 additions & 2 deletions src/page/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
useLocation
} from 'react-router-dom';

import { aboutHeader } from "../../config/About/AboutData";
import { abouts } from "../../config/about";

import NavBar from "../../components/Navbar";
import Sidebar from "../../components/SideBar/SideBar";
Expand Down Expand Up @@ -32,7 +32,7 @@ const About: React.FC = () => {
className={`about ${location.pathname === '/' ? 'active' : ''}`}
data-page="about"
>
<Header title={aboutHeader} />
<Header title={abouts.header} />
<AboutText />
<TechStack />
<LifeStyles />
Expand Down

0 comments on commit 7a6b7ee

Please sign in to comment.