Skip to content

Commit

Permalink
Restructured home page
Browse files Browse the repository at this point in the history
- Added latest post and project to home screen
- Removed home page button components

Signed-off-by: Alan P John <[email protected]>
  • Loading branch information
alanpjohn committed May 24, 2024
1 parent b094317 commit 577478c
Show file tree
Hide file tree
Showing 16 changed files with 4,570 additions and 11,523 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.2] - 2024-05-24
## Added
- Latest post and project to home screen
## Removed
- Home page button components

## [4.0.1] - 2024-03-15
Removed Notion Support
### Added
Expand Down
1 change: 0 additions & 1 deletion _projects/ukfaasd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ tags:
- serverless
- unikernel
- openfaas
- unikraft
date: 2023-09-01
url: https://github.com/alanpjohn/ukfaas
cover: ukfaas
Expand Down
12,852 changes: 1,443 additions & 11,409 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-notion-portfolio",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down Expand Up @@ -31,7 +31,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-notion-x": "^6.16.0",
"remark": "^14.0.3",
"remark-html": "^15.0.2",
"sass": "^1.66.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { AppProps } from "next/app";
import Script from "next/script";
import "prismjs/themes/prism-tomorrow.css";
import React, { useEffect } from "react";
import "react-notion-x/src/styles.css";

import "@styles/notion.css";
import "@styles/styles.scss";

function MyApp({ Component, pageProps, router }: AppProps): JSX.Element {
Expand Down
79 changes: 44 additions & 35 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { HomeButton } from "@components/button/home";
import { HomeCard } from "@components/card/home";
import { Tag } from "@components/card/tag";
import { CustomImage } from "@components/image";
import { Layout } from "@components/layout";
import { Section } from "@components/section";

import { domain } from "@util/config";
import { BlogArticle, ITag, Project } from "@util/interface";
import { getFeaturedProject, getLatestBlog } from "@util/markdown";
import { getPreviewImage } from "@util/preview-image";

import { GetStaticProps, NextPage } from "next";
Expand All @@ -12,9 +15,11 @@ import { PreviewImage } from "notion-types";

type Props = {
preview: PreviewImage;
blog: BlogArticle;
project: Project;
};

const Home: NextPage<Props> = ({ preview }: Props) => {
const Home: NextPage<Props> = ({ preview, blog, project }: Props) => {
return (
<Layout>
<NextSeo
Expand All @@ -28,57 +33,56 @@ const Home: NextPage<Props> = ({ preview }: Props) => {
]}
/>
<Section className="mt-32 lg:mt-24 flex-grow mx-auto justify-center">
<div className="flex flex-col font-sans px-4">
<div className="flex flex-col px-4">
<h1
className="text-2xl lg:text-4xl
className="text-3xl lg:text-4xl
font-light pr-12 mb-4 pb-2 w-min whitespace-nowrap border-dotted
border-b-4 border-accent-alternate"
>
Alan John
</h1>
<h2 className="text-3xl md:text-7xl md:pl-4 whitespace-pre-wrap">
<h2 className="text-3xl md:text-5xl lg:text-7xl md:pl-4 whitespace-pre-wrap">
Software Developer
</h2>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 grid-flow-row mx-auto mt-6">
<div className="md:row-span-2 max-w-sm p-4 mr-4">
<div className="grid grid-cols-1 md:grid-cols-2 grid-flow-row mx-auto mt-6">
<div className="md:row-span-2 max-w-sm p-4 mx-auto">
<CustomImage
alt="Alan John"
src="/images/Alan.jpg"
height={preview.originalHeight}
width={preview.originalWidth}
className="rounded-md"
placeholder="blur"
blurDataURL={preview.dataURIBase64}
/>
</div>
<HomeButton
href={"/about"}
title={"about"}
subtitle={"There is more to him"}
description={
"Considering this page does not have much about him"
}
/>
<HomeButton
href={"/blog"}
title={"blog"}
subtitle={"He writes"}
description={"He ought to be more regular with it"}
/>
<HomeButton
href={"https://photos.alanjohn.dev"}
title={"Photos"}
subtitle={"He clicks pictures"}
description={
"He is trying his best to be artsy about it"
}
/>
<HomeButton
href={"/projects"}
title={"projects"}
subtitle={"He has projects"}
description={"Surprise, surprise"}
/>
<HomeCard
title={blog.title}
subtitle={blog.description}
isBlog={true}
url={"/blog/" + blog.url}
>
{blog.tags.length > 0 && (
<div className="flex flex-wrap shrink">
{blog.tags.map((tag: ITag) => (
<Tag key={tag.id} {...tag} />
))}
</div>
)}
</HomeCard>
<HomeCard
title={project.title}
subtitle={project.description}
>
{project.tags.length > 0 && (
<div className="flex flex-wrap shrink">
{blog.tags.map((tag: ITag) => (
<Tag key={tag.id} {...tag} />
))}
</div>
)}
</HomeCard>
</div>
</Section>
</Layout>
Expand All @@ -90,9 +94,14 @@ export const getStaticProps: GetStaticProps<Props> = async () => {
cacheKey: "home",
});

const project = await getFeaturedProject();
const blogArticle = await getLatestBlog();

return {
props: {
preview: preview,
blog: blogArticle,
project: project,
},
revalidate: 86400,
};
Expand Down
63 changes: 0 additions & 63 deletions src/components/button/home.tsx

This file was deleted.

52 changes: 52 additions & 0 deletions src/components/card/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { CustomLink } from "@components/link";

import { PropsWithChildren } from "react";
import { BsArrowRight } from "react-icons/bs";

type Props = PropsWithChildren<{
title: string;
subtitle: string;
url?: string;
isBlog?: boolean;
}>;

export const HomeCard: React.FC<Props> = ({
title,
subtitle,
url = "/projects",
isBlog = false,
children,
}: Props) => {
let keyText = "Featured Project";
if (isBlog) {
keyText = "Featured Blog Article";
}
return (
<CustomLink
href={url}
className="m-2 p-4
max-w-md
border-background-primary dark:border-foreground-primary
bg-background-secondary dark:bg-foreground-secondary
border-2 rounded-md
flex flex-col justify-between
"
>
<span className="text-xs font-mono text-accent-primary dark:text-accent-secondary text-opacity-70">
{keyText}
</span>
<span className="px-1 text-xl font-sans text-foreground-primary dark:text-background-primary">
{title}
</span>
<span className="px-1 text-s text-foreground-primary dark:text-background-primary">
{subtitle}
</span>
{children}

<div className="flex flex-row items-center w-full justify-end">
<span className="text-xs font-mono mr-2">Check out</span>
<BsArrowRight />
</div>
</CustomLink>
);
};
6 changes: 3 additions & 3 deletions src/components/card/tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const Tag: React.FC<Props> = ({ id, name }: Props) => {
return (
<span
key={id}
className=" text-jet
className=" text-background-secondary
bg-accent-primary dark:bg-accent-secondary whitespace-nowrap
h-8 px-4 m-1 rounded-full
font-sans text-lg"
h-6 px-4 m-1 rounded-full items-center flex
font-sans text-sm"
>
{name}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const NotionHeader: React.FC = () => {
<div className="notion-nav-header-rhs">
<CustomLink
href="/blog"
className="font-sans text-xl font-normal flex flex-row items-center hover:text-accent dark:hover:text-accent-secondary"
className="font-sans text-xl font-normal flex flex-row items-center hover:text-accent-primary dark:hover:text-accent-secondary"
>
<BsArrowLeftCircle className="mx-2" /> Explore Blog
</CustomLink>
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Header: React.FC = () => {
<div className="p-1 flex flex-row justify-center items-center">
{internalLinks.map((link) => (
<CustomLink
className="hover:text-accent dark:hover:text-accent-secondary mx-2 uppercase font-mono text-sm sm:text-lg font-medium"
className="hover:text-accent-primary dark:hover:text-accent-secondary mx-2 uppercase font-mono text-sm sm:text-lg font-medium"
key={link.text}
href={link.url.toString()}
>
Expand Down
Loading

0 comments on commit 577478c

Please sign in to comment.