added portfolio page data
This commit is contained in:
parent
29756fad8f
commit
7f01059dc3
2 changed files with 52 additions and 26 deletions
|
@ -5,9 +5,11 @@ import styled from "styled-components"
|
||||||
|
|
||||||
import { PageData, Map } from "../../../types/types"
|
import { PageData, Map } from "../../../types/types"
|
||||||
|
|
||||||
|
import GithubLinkIcon from "../../components/GithubLinkIcon"
|
||||||
import MainContent from "../../components/MainContent"
|
import MainContent from "../../components/MainContent"
|
||||||
import Loading from "../../components/Loading"
|
import Loading from "../../components/Loading"
|
||||||
import TagList from "../../components/TagList"
|
import TagList from "../../components/TagList"
|
||||||
|
import Badge from "../../components/Badge"
|
||||||
import Tag from "../../components/Tag"
|
import Tag from "../../components/Tag"
|
||||||
import NotFound from "../NotFound"
|
import NotFound from "../NotFound"
|
||||||
|
|
||||||
|
@ -25,6 +27,15 @@ const StyledTitle = styled.h1`
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const PortfolioGithubLinkContainer = styled.div`
|
||||||
|
float: right;
|
||||||
|
margin-top: 1rem;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ProjectImage = styled.img`
|
||||||
|
max-width: 100%;
|
||||||
|
`
|
||||||
|
|
||||||
enum PageType {
|
enum PageType {
|
||||||
POST,
|
POST,
|
||||||
SERIES,
|
SERIES,
|
||||||
|
@ -124,6 +135,11 @@ const Page = () => {
|
||||||
tags: [],
|
tags: [],
|
||||||
toc: undefined,
|
toc: undefined,
|
||||||
content: "No content",
|
content: "No content",
|
||||||
|
|
||||||
|
image: "",
|
||||||
|
overview: "",
|
||||||
|
badges: [],
|
||||||
|
repo: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchContent(_pageType, url).then((fetched_content) => {
|
fetchContent(_pageType, url).then((fetched_content) => {
|
||||||
|
@ -187,28 +203,14 @@ const Page = () => {
|
||||||
url as keyof typeof portfolio.projects
|
url as keyof typeof portfolio.projects
|
||||||
]
|
]
|
||||||
|
|
||||||
console.log(fetched_content)
|
|
||||||
|
|
||||||
pageData.content = fetched_content.content
|
pageData.content = fetched_content.content
|
||||||
pageData.toc = fetched_content.toc
|
pageData.toc = fetched_content.toc
|
||||||
|
|
||||||
pageData.title = data.name
|
pageData.title = data.name
|
||||||
|
pageData.image = data.image
|
||||||
// todo: add portfolio data
|
pageData.overview = data.overview
|
||||||
/*
|
pageData.badges = data.badges
|
||||||
"image": "/img/portfolio/developomp.com.png",
|
pageData.repo = data.repo
|
||||||
"overview": "my website for blogging, portfolio, and resume.",
|
|
||||||
"badges": [
|
|
||||||
"typescript",
|
|
||||||
"javascript",
|
|
||||||
"nodedotjs",
|
|
||||||
"firebase",
|
|
||||||
"react",
|
|
||||||
"html5",
|
|
||||||
"css3"
|
|
||||||
],
|
|
||||||
"repo": "https://github.com/developomp/developomp-site"
|
|
||||||
*/
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -241,24 +243,34 @@ const Page = () => {
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta
|
<meta
|
||||||
property="og:image"
|
property="og:image"
|
||||||
content={`${process.env.PUBLIC_URL}/icon/icon.svg`}
|
content={process.env.PUBLIC_URL + "/icon/icon.svg"}
|
||||||
/>
|
/>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
|
||||||
<MainContent>
|
<MainContent>
|
||||||
{pageType == PageType.SERIES ? (
|
{/* next/previous series post buttons */}
|
||||||
|
{pageType == PageType.SERIES && (
|
||||||
<NextPrevButtons
|
<NextPrevButtons
|
||||||
prevURL={seriesData?.prev}
|
prevURL={seriesData?.prev}
|
||||||
nextURL={seriesData?.next}
|
nextURL={seriesData?.next}
|
||||||
/>
|
/>
|
||||||
) : (
|
)}
|
||||||
<br />
|
|
||||||
|
{pageType == PageType.PORTFOLIO_PROJECT && (
|
||||||
|
<PortfolioGithubLinkContainer>
|
||||||
|
<GithubLinkIcon link={pageData.repo} />
|
||||||
|
</PortfolioGithubLinkContainer>
|
||||||
)}
|
)}
|
||||||
<StyledTitle>{pageData.title}</StyledTitle>
|
<StyledTitle>{pageData.title}</StyledTitle>
|
||||||
|
|
||||||
|
{pageType == PageType.PORTFOLIO_PROJECT &&
|
||||||
|
pageData.badges.map((badge) => (
|
||||||
|
<Badge key={badge} slug={badge} />
|
||||||
|
))}
|
||||||
|
|
||||||
<small>
|
<small>
|
||||||
{/* Post tags */}
|
{/* Post tags */}
|
||||||
{!!pageData.tags.length && (
|
{pageData.tags.length > 0 && (
|
||||||
<TagList direction="left">
|
<TagList direction="left">
|
||||||
{pageData.tags.map((tag) => {
|
{pageData.tags.map((tag) => {
|
||||||
return (
|
return (
|
||||||
|
@ -273,9 +285,9 @@ const Page = () => {
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
{/* Post metadata */}
|
{/* Post metadata */}
|
||||||
{pageType != PageType.UNSEARCHABLE && (
|
{[PageType.UNSEARCHABLE, PageType.POST].includes(
|
||||||
<Meta fetchedPage={pageData} />
|
pageType
|
||||||
)}
|
) && <Meta fetchedPage={pageData} />}
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
@ -283,6 +295,13 @@ const Page = () => {
|
||||||
{/* add table of contents if it exists */}
|
{/* add table of contents if it exists */}
|
||||||
<Toc data={pageData.toc} />
|
<Toc data={pageData.toc} />
|
||||||
|
|
||||||
|
{pageType == PageType.PORTFOLIO_PROJECT && (
|
||||||
|
<ProjectImage
|
||||||
|
src={pageData.image}
|
||||||
|
alt="project example image"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* page content */}
|
{/* page content */}
|
||||||
<div
|
<div
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
|
|
|
@ -61,6 +61,13 @@ export interface PageData {
|
||||||
tags: string[]
|
tags: string[]
|
||||||
toc?: string
|
toc?: string
|
||||||
content: string
|
content: string
|
||||||
|
|
||||||
|
// portfolio-specific data
|
||||||
|
|
||||||
|
image: string // image url
|
||||||
|
overview: string
|
||||||
|
badges: string[]
|
||||||
|
repo: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue