Skip to content

Commit

Permalink
refactor(about): description with react-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
1chooo committed Jul 13, 2024
1 parent dc58f3e commit 2a9b7e7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 35 deletions.
34 changes: 34 additions & 0 deletions src/components/Anchor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { ReactNode } from 'react';

interface AnchorProps {
children?: ReactNode;
href?: string;
className?: string;
target?: string;
rel?: string;
[key: string]: any; // To allow any additional props
}

const Anchor: React.FC<AnchorProps> = ({ children, ...props }) => {
const isEmpty = !children ||
(Array.isArray(children) && children.length === 0) ||
(typeof children === 'string' && children.trim().length === 0) ||
(React.Children.count(children) === 0);

if (isEmpty) {
return null;
}

return (
<a
className="code-highlight-yellow"
target="_blank"
rel="noreferrer"
{...props}
>
{children}
</a>
);
};

export default Anchor;
56 changes: 21 additions & 35 deletions src/config/About/AboutData.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
// AboutTextData.tsx
import React from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import Anchor from '../../components/Anchor'; // Adjust the import path accordingly


export const aboutHeader: string = "About Hugo πŸ‘¨πŸ»β€πŸ’»";

export const messages: JSX.Element[] = [
(
<p key="announcement">
<h4>πŸ“’ <code className="code-highlight-yellow">2024 eCloudvalley Intern - Cloud Engineer πŸ‘¨πŸ»β€πŸ’»</code></h4>
</p>
),
(
<p>
I'm <strong>Hugo ChunHo Lin</strong>, a 4th-year student at
<a
href="https://www.ncu.edu.tw/"
className="code-highlight-yellow"
target="_blank"
rel="noreferrer"
> National Central University 🐿️
</a>, fueled by a <em><strong>sincere passion </strong></em>
for the field of <strong>Software Engineering πŸ’»</strong>.
</p>
),
(
<p>
<em>I do <strong>Web Development and Cloud Development </strong>
with a focus on <strong>creating APIs and handling backend tasks </strong>
using <code className="code-highlight-yellow">FastAPI, Gin, and AWS</code>. </em>
export const 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 πŸ’».**
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.
</p>
),
*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 🌏*.
`;

export const messages: JSX.Element[] = [
(
<p>
In my spare time, I do <em>street photography πŸ“·</em> and <em>consistently share my findings on GitHub with Global 🌏.</em>
</p>
<ReactMarkdown
key="content"
children={description}
remarkPlugins={[remarkGfm]}
components={{
a: ({ node, ...props }) => <Anchor {...props} />,
}}
/>
),
];


0 comments on commit 2a9b7e7

Please sign in to comment.