-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(about): description with react-markdown
- Loading branch information
Showing
2 changed files
with
55 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} />, | ||
}} | ||
/> | ||
), | ||
]; | ||
|
||
|