Skip to content

Commit

Permalink
Add site contents (#4)
Browse files Browse the repository at this point in the history
* Update site metadata

* Update site icon

* Add basic page structure

* Add styles + improve tests

* Add icons + links

* Add tooltip

* Fix hover bug

* Fix build issues

* CSS fixes
  • Loading branch information
SoorajModi authored Jun 27, 2024
1 parent 0bf7fa9 commit 88b8d84
Show file tree
Hide file tree
Showing 15 changed files with 288 additions and 132 deletions.
30 changes: 30 additions & 0 deletions app/components/customIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import React from "react";
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from 'react-tooltip';

export interface CustomIconProps {
icon: IconProp,
href: string,
circleStyle: string,
iconStyle: string,
tooltip: string,
download: boolean,
}

function CustomIcon(props: CustomIconProps) {
return (
<div className="pb-3 md:pb-0">
<a href={props.href} target="_blank" rel="noopener noreferrer" className={`${props.circleStyle} group flex rounded-full h-12 w-12 bg-gray-500 items-center justify-center`} download={props.download} data-tooltip-id={"tooltip"} data-tooltip-content={props.tooltip} data-tooltip-place="bottom">
<div className={`${props.iconStyle} text-black flex items-center justify-center`}>
<FontAwesomeIcon icon={props.icon} size="2x" />
</div>
</a>
<Tooltip id={"tooltip"} />
</div>
)
}

export default CustomIcon;
30 changes: 30 additions & 0 deletions app/components/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import Image from "next/image";
import Links from "./links";

export const messages = {
name: 'Sooraj Modi',
alt: 'Sooraj Modi profile picture',
title: 'Software Developer',
description: 'Hi my name is Sooraj, and welcome to my website. I am a full stack software developer who loves taking on new challenges and working on fun projects that improve our world! Feel free to reach out.',
};

function Home() {
return (
<div className="h-screen min-h-[50rem] flex justify-center items-center flex-col text-center text-white">
<Image
src="/profile.png"
alt={messages.alt}
width={300}
height={300}
priority
/>
<h1 className="text-4xl sm:text-6xl py-2">{messages.name}</h1>
<h2 className="text-neutral-400 text-lg sm:text-2xl pb-5">{messages.title}</h2>
<p className="text-base sm:text-xl flex justify-center align-center pb-10 max-w-96 break-normal mx-5" data-testid="description">{messages.description}</p>
<Links />
</div>
)
}

export default Home;
61 changes: 61 additions & 0 deletions app/components/links.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use client";

import React from "react";
import {
faDiscord,
faGithub,
faLinkedin,
} from '@fortawesome/free-brands-svg-icons';
import { faFileAlt } from '@fortawesome/free-solid-svg-icons';
import CustomIcon, { CustomIconProps } from './customIcon';

const list: Array<CustomIconProps> = [
{
icon: faGithub,
href: 'https://github.com/SoorajModi',
tooltip: 'GitHub',
circleStyle: 'hover:bg-white',
iconStyle: 'group-hover:text-black',
download: false,
},
{
icon: faLinkedin,
href: 'https://www.linkedin.com/in/soorajmodi/',
tooltip: 'LinkedIn',
circleStyle: 'hover:bg-white',
iconStyle: 'group-hover:text-linkedin-blue',
download: false,
},
{
icon: faDiscord,
href: 'https://discordapp.com/users/356956593293754368',
tooltip: 'Discord',
circleStyle: 'hover:bg-discord-purple',
iconStyle: 'group-hover:text-white',
download: false,
},
{
icon: faFileAlt,
href: '/SoorajModiResume.pdf',
tooltip: 'Resume',
circleStyle: 'hover:bg-red-500',
iconStyle: 'group-hover:text-white',
download: true,
},
];

function Links() {
return (
<div className="w-full flex justify-center align-center">
{
list.map((link, index) => (
<div className="flex px-5" key={index}>
<CustomIcon {...link} />
</div>
))
}
</div>
);
}

export default Links;
Binary file modified app/favicon.ico
Binary file not shown.
11 changes: 6 additions & 5 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
background-color: #23395D;
/* --foreground-rgb: 0, 0, 0; */
/* --background-start-rgb: 214, 219, 220; */
/* --background-end-rgb: 255, 255, 255; */
}

@media (prefers-color-scheme: dark) {
/* @media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
} */

body {
color: rgb(var(--foreground-rgb));
Expand Down
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import "./globals.css";
const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "Sooraj Modi",
description: "The official portfolio website for Sooraj Modi",
};

export default function RootLayout({
Expand Down
43 changes: 37 additions & 6 deletions app/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
import React from 'react'
import '@testing-library/jest-dom'
import { render, screen, within } from '@testing-library/react'
import Home from './page'
import Page from './page'
import { messages } from './components/home'

describe('Page', () => {
it('renders getStarted message', () => {
render(<Home />)
it('renders name', () => {
render(<Page />)

const name = screen.getByRole('heading', { level: 1 });

const getStarted = screen.getByText('Get started by editing', { exact: false });
expect(name).toBeInTheDocument()
expect(name).toHaveTextContent(messages.name);
})

it('renders title', () => {
render(<Page />)

const title = screen.getByRole('heading', { level: 2 });

expect(title).toBeInTheDocument()
expect(title).toHaveTextContent(messages.title);
})

it('renders description', () => {
render(<Page />)

const description = screen.getByRole('paragraph');

expect(description).toBeInTheDocument()
expect(description).toHaveTextContent(messages.description)
})

it('renders profile image', () => {
render(<Page />)

const image = screen.getByRole('img');

expect(getStarted).toBeInTheDocument()
expect(getStarted).toHaveTextContent('Get started by editing');
expect(image).toBeInTheDocument()
expect(image).toHaveAttribute('src', expect.stringMatching('profile\.png'))
expect(image).toHaveAttribute('alt', messages.alt)
expect(image).toHaveAttribute('height', "300")
expect(image).toHaveAttribute('width', "300")
})
})
112 changes: 4 additions & 108 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,114 +1,10 @@
import React from 'react';
import Image from "next/image";
import Home from './components/home';

export default function Home() {
export default function Page() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
Get started by editing&nbsp;
<code className="font-mono font-bold">app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:size-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{" "}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
</div>

<div className="relative z-[-1] flex place-items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<div className="mb-32 grid text-center lg:mb-0 lg:w-full lg:max-w-5xl lg:grid-cols-4 lg:text-left">
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Docs{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Find in-depth information about Next.js features and API.
</p>
</a>

<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Learn{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Learn about Next.js in an interactive course with&nbsp;quizzes!
</p>
</a>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Templates{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Explore starter templates for Next.js.
</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Deploy{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-balance text-sm opacity-50">
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
<main className="min-h-screen">
<Home />
</main>
);
}
Loading

0 comments on commit 88b8d84

Please sign in to comment.