From 9f89820095dc35cfdb154bab10248cd3671bb74f Mon Sep 17 00:00:00 2001 From: Hugo ChunHo Lin Date: Sun, 4 Aug 2024 18:25:49 +0800 Subject: [PATCH] style(#24): rename about with lower camel case --- src/components/about/AboutText.tsx | 25 +++++++++++ src/components/about/Clients.tsx | 43 ++++++++++++++++++ src/components/about/GitHubStats.tsx | 66 ++++++++++++++++++++++++++++ src/components/about/LifeStyles.tsx | 35 +++++++++++++++ src/components/about/SubHeader.tsx | 15 +++++++ src/components/about/TechStack.tsx | 32 ++++++++++++++ src/page/About/index.tsx | 8 ++-- 7 files changed, 220 insertions(+), 4 deletions(-) create mode 100644 src/components/about/AboutText.tsx create mode 100644 src/components/about/Clients.tsx create mode 100644 src/components/about/GitHubStats.tsx create mode 100644 src/components/about/LifeStyles.tsx create mode 100644 src/components/about/SubHeader.tsx create mode 100644 src/components/about/TechStack.tsx diff --git a/src/components/about/AboutText.tsx b/src/components/about/AboutText.tsx new file mode 100644 index 00000000..a5118a8d --- /dev/null +++ b/src/components/about/AboutText.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import SubHeader from './SubHeader'; +import MarkdownRenderer from '../MarkdownRenderer'; + +import { abouts } from '../../config/about'; + +const { subHeader, introductions, pronouns } = abouts; + +const AboutText: React.FC = () => { + + const renderIntroduction = () => + introductions.map((item, index) => ( + + )); + + return ( +
+ +
+ {renderIntroduction()} +
+ ); +}; + +export default AboutText; diff --git a/src/components/about/Clients.tsx b/src/components/about/Clients.tsx new file mode 100644 index 00000000..10418f0d --- /dev/null +++ b/src/components/about/Clients.tsx @@ -0,0 +1,43 @@ +import chaewonImage from "../../Assets/images/idols/chaewon_01.png"; +import chaewonImage3 from "../../Assets/images/idols/chaewon_03.png"; +import yoonaImage from "../../Assets/images/idols/yoona_01.png"; +import yoonaImage2 from "../../Assets/images/idols/yoona_02.png"; +import yujinImage from "../../Assets/images/idols/yujin.png"; + +interface Client { + image: string; + alt: string; +} + +const clients: Client[] = [ + { image: chaewonImage, alt: "ChaeWon Image" }, + { image: yoonaImage, alt: "Yoona Image" }, + { image: yoonaImage2, alt: "Yoona Image" }, + { image: yujinImage, alt: "YuJin Image" }, + { image: chaewonImage3, alt: "ChaeWon Image" } +]; + + + +const Clients: React.FC = () => { + return ( + +
+ +

+

$ ls -al Idols

+

+ +
    + {clients.map((client, index) => ( +
  • + {client.alt} +
  • + ))} +
+ +
+ ); +} + +export default Clients; diff --git a/src/components/about/GitHubStats.tsx b/src/components/about/GitHubStats.tsx new file mode 100644 index 00000000..d3ac0b4c --- /dev/null +++ b/src/components/about/GitHubStats.tsx @@ -0,0 +1,66 @@ +import React, { useEffect, useState, FC } from 'react'; +import { useSearchParams } from 'react-router-dom'; +import GitHubCalendar from 'react-github-calendar'; +import { ThemeInput } from 'react-activity-calendar'; + +import SubHeader from './SubHeader'; +import { abouts } from '../../config/about'; + +/* +* goto https://grubersjoe.github.io/react-activity-calendar/ +* to see more themes +*/ +const yellowTheme: ThemeInput = { + light: ['hsl(0, 0%, 92%)', '#FFDA6B'], + dark: ['hsl(0, 0%, 22%)', '#FFDA6B'], +}; + +const { githubUsername } = abouts; +const subHeaderText = '$ ls -al GitHub Stats'; +const MOBILE_CALENDAR_SIZE = 12; +const LAPTOP_CALENDAR_SIZE = 12; +const MOBILE_BREAKPOINT = 768; + +const GitHubStats: FC = () => { + const [searchParams] = useSearchParams(); + const initialUsername = searchParams.get('user') ?? githubUsername; + + const [username, setUsername] = useState(initialUsername); + const [windowWidth, setWindowWidth] = useState(window.innerWidth); + + useEffect(() => { + const handleResize = () => { + setWindowWidth(window.innerWidth); + }; + + window.addEventListener('resize', handleResize); + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); + + useEffect(() => { + setUsername(initialUsername); + }, [initialUsername]); + + const isMobile = windowWidth <= MOBILE_BREAKPOINT; + + return ( +
+ +
+ +
+ ); +}; + +export default GitHubStats; diff --git a/src/components/about/LifeStyles.tsx b/src/components/about/LifeStyles.tsx new file mode 100644 index 00000000..d40b4aac --- /dev/null +++ b/src/components/about/LifeStyles.tsx @@ -0,0 +1,35 @@ +import { abouts } from '../../config/about'; +import { ILifeStyle } from '../../interface/IAbout'; +import SubHeader from './SubHeader'; + + +const subHeader = "$ ls -al Life Style"; + + +const LifeStyles: React.FC = () => { + const { lifestyle: lifestyles } = abouts; + + // TODO: update inheritance of p.h3 + return ( +
+ + +
    + {lifestyles.map((lifestyle: ILifeStyle, index: number) => ( // TODO: Do not use Array index in keys +
  • +
    + {lifestyle.title} +
    +
    +

    {lifestyle.title}

    +

    {lifestyle.text}

    +
    +
  • + ))} +
+ +
+ ); +} + +export default LifeStyles; diff --git a/src/components/about/SubHeader.tsx b/src/components/about/SubHeader.tsx new file mode 100644 index 00000000..85765790 --- /dev/null +++ b/src/components/about/SubHeader.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +interface SubHeaderProps { + text: string; +} + +const SubHeader: React.FC = ({ text }) => { + return ( +

+ {text} +

+ ); +}; + +export default SubHeader; diff --git a/src/components/about/TechStack.tsx b/src/components/about/TechStack.tsx new file mode 100644 index 00000000..8054a90f --- /dev/null +++ b/src/components/about/TechStack.tsx @@ -0,0 +1,32 @@ +import { abouts } from '../../config/about'; +import { ITechStack } from '../../interface/IAbout'; +import SubHeader from './SubHeader'; + + +const subHeader = "$ ls -al Tech Stack"; +const TechStack: React.FC = () => { + const { programmingLanguage, devOps } = abouts; + + const renderTechStackList = (techStack: ITechStack[]) => { + return ( +
    + {techStack.map((item: ITechStack) => ( +
  • + {item.name} +
  • + ))} +
+ ); + }; + + return ( +
+ + + {renderTechStackList(programmingLanguage)} + {renderTechStackList(devOps)} +
+ ); +} + +export default TechStack; diff --git a/src/page/About/index.tsx b/src/page/About/index.tsx index bba62ed6..3778c695 100644 --- a/src/page/About/index.tsx +++ b/src/page/About/index.tsx @@ -5,10 +5,10 @@ import { abouts } from "../../config/about"; import NavBar from "../../components/Navbar"; import Sidebar from "../../components/sideBar/SideBar"; -import AboutText from "../../components/About/AboutText"; -import LifeStyles from "../../components/About/LifeStyles"; -import GitHubStats from "../../components/About/GitHubStats"; -import TechStack from "../../components/About/TechStack"; +import AboutText from "../../components/about/AboutText"; +import LifeStyles from "../../components/about/LifeStyles"; +import GitHubStats from "../../components/about/GitHubStats"; +import TechStack from "../../components/about/TechStack"; import Header from "../../components/Header";