Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next14 upgrade #5

Merged
merged 7 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Script from "next/script";

import * as gtag from "../lib/gtag";

function Analytics() {
return (
<>
<Script
strategy="afterInteractive"
src={`https://www.googletagmanager.com/gtag/js?id=${gtag.GA_TRACKING_ID}`}
/>
<Script
id="gtag-init"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${gtag.GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
</>
);
}
export default Analytics;
32 changes: 32 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import "../styles/globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";

import { Providers } from "./provider";
import Analytics from "./Analytics";

export const metadata: Metadata = {
title: {
template: "%s | Nishchay",
default: "Nishchay",
},
description: "Portfolio made with Next JS | Nishchay17",
icons: ["/svg/logo.svg"],
};

const inter = Inter({ subsets: ["latin"] });

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<Analytics />
<Providers>{children}</Providers>
</body>
</html>
);
}
10 changes: 4 additions & 6 deletions pages/index.tsx → app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { ReactElement } from "react";
import dynamic from "next/dynamic";
import { Container } from "@chakra-ui/layout";

const HeroSection = dynamic(() => import("../components/Landing/HeroSection"));
const Projects = dynamic(() => import("../components/Landing/Projects"));
const Tech = dynamic(() => import("../components/Landing/Tech"));
const Social = dynamic(() => import("../components/Landing/Social"));

import HeroSection from "../components/Landing/HeroSection";
import Projects from "../components/Landing/Projects";
import Tech from "../components/Landing/Tech";
import Social from "../components/Landing/Social";
import Layout from "../components/Layout";

function Home(): ReactElement {
Expand Down
32 changes: 32 additions & 0 deletions app/project/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { ReactElement } from "react";
import type { Metadata } from "next";

import ProjectLayout from "../../../components/ProjectPage/ProjectLayout";
import Layout from "../../../components/Layout";
import { projects } from "../../../config/project";
import { Project } from "../../../interface/Project";

export const metadata: Metadata = {
title: "Project",
};

function Project({ params: { id } }: { params: { id: string } }): ReactElement {
let project: Project = {
id: 99,
name: "No project found",
description: "No project with this Id found",
tag: "",
};
if (id) {
const currentProject = projects.find((project) => project.id == +id);
if (!!currentProject) {
project = currentProject;
}
}

return (
<Layout>{!project ? <></> : <ProjectLayout project={project} />}</Layout>
);
}

export default Project;
14 changes: 14 additions & 0 deletions app/provider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

import { ChakraProvider } from "@chakra-ui/react";
import { AnimatePresence } from "framer-motion";

import { theme } from "../lib/theme";

export function Providers({ children }: { children: React.ReactNode }) {
return (
<ChakraProvider theme={theme}>
<AnimatePresence>{children}</AnimatePresence>
</ChakraProvider>
);
}
27 changes: 2 additions & 25 deletions components/Landing/Experience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,7 @@ import React, { ReactElement } from "react";
import { Box, Flex, Text, List, ListItem, ListIcon } from "@chakra-ui/react";
import { FiMinus } from "react-icons/fi";

const exps = [
{
company: "Homelane",
title: "Software Engineer Intern",
date: "Jan 2022 - Present",
points: [
"Worked on developing dashboard using React js and SCSS",
"Migrated vanilla javascript code to React js code",
"Fixed existing bugs and added functionalities in dashboards",
"Converted design to pixel-perfect components",
],
},
{
company: "The Internet Folks",
title: "Software Engineer Intern",
date: "Dec 2020 - June 2021",
points: [
"Used Next js (react js) with server-side rendering",
"Used Redux (Redux toolkit) for state management",
"Converted UI design to reusable, scalable react components",
"Implemented Debouncing to reduce API calls",
],
},
];
import { experience } from "../../config/experience";

function Experience(): ReactElement {
return (
Expand All @@ -34,7 +11,7 @@ function Experience(): ReactElement {
Experience
</Text>

{exps.map(({ company, title, points, date }) => {
{experience.map(({ company, title, points, date }) => {
return (
<Box key={date} mb="2rem">
<Box
Expand Down
6 changes: 2 additions & 4 deletions components/Landing/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function HeroSection(): ReactElement {
fontSize={["2.75rem", "3rem", "4rem", "6vw"]}
letterSpacing="1px"
lineHeight={1}
fontWeight={600}
fontWeight={500}
textAlign="center"
>
Hello there <br /> I am Nishchay
Expand All @@ -46,7 +46,7 @@ function HeroSection(): ReactElement {
animate={{ opacity: 1 }}
transition={{ delay: 0.6 }}
as={Text}
fontSize={["1.1rem", "1.2rem", "1.4rem", "1.5rem", "1.5vw"]}
fontSize={["1.1rem", "1.2rem", "1.3rem", "1.4rem", "1.4vw"]}
mt="1rem"
color="blackAlpha.800"
lineHeight="120%"
Expand All @@ -70,7 +70,6 @@ function HeroSection(): ReactElement {
>
<Button
variant="btn-black"
isFullWidth={false}
leftIcon={<FiDownload size="1.2rem" />}
size="sm"
>
Expand All @@ -84,7 +83,6 @@ function HeroSection(): ReactElement {
variant="btn-black"
initial={{ scale: 0.9 }}
animate={{ scale: 1 }}
isFullWidth={false}
leftIcon={<FiMail size="1.2rem" />}
ml={[0, "1rem"]}
mt={["1rem", 0]}
Expand Down
92 changes: 46 additions & 46 deletions components/Landing/Projects.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import React, { ReactElement, useEffect } from "react";
import Link from "next/link";
import Image from "next/image";
Expand Down Expand Up @@ -46,53 +48,51 @@ function ProjectCard({

return (
<Link href={`/project/${id}`}>
<a>
<MotionBox
ref={ref}
initial="hidden"
animate={controls}
variants={item}
custom={index}
cursor="pointer"
width={"100%"}
height={"100%"}
borderRadius="7px"
border="1px"
<MotionBox
ref={ref}
initial="hidden"
animate={controls}
variants={item}
custom={index}
cursor="pointer"
width={"100%"}
height={"100%"}
borderRadius="7px"
border="1px"
borderColor="blackAlpha.300"
overflow="hidden"
>
<MotionBox initial={false} layoutId={id} position="relative">
<Image
style={{ objectFit: "cover" }}
src={image ? `/img/${image}` : "/img/no-img.png"}
height={400}
width={708}
quality={100}
alt={`${image}`}
draggable={false}
/>
</MotionBox>
<Box
borderTop="1px"
borderColor="blackAlpha.300"
overflow="hidden"
mt={-1.5}
px="1rem"
pb="1rem"
bg={bg}
h="full"
>
<MotionBox initial={false} layoutId={id} position="relative">
<Image
objectFit="cover"
src={image ? `/img/${image}` : "/img/no-img.png"}
height={400}
width={708}
quality={100}
alt={`${image}`}
draggable={false}
/>
</MotionBox>
<Box
borderTop="1px"
borderColor="blackAlpha.300"
mt={-1.5}
px="1rem"
pb="1rem"
bg={bg}
h="full"
>
<Flex gap="0.5rem" alignItems="center" mt="1rem">
<Text fontSize="xl">{name}</Text>
{additionalTags?.map((tag) => (
<Badge colorScheme="purple" key={tag}>
{tag}
</Badge>
))}
</Flex>
<Text>{description}</Text>
</Box>
</MotionBox>
</a>
<Flex gap="0.5rem" alignItems="center" mt="1rem">
<Text fontSize="xl">{name}</Text>
{additionalTags?.map((tag) => (
<Badge colorScheme="purple" key={tag}>
{tag}
</Badge>
))}
</Flex>
<Text>{description}</Text>
</Box>
</MotionBox>
</Link>
);
}
Expand All @@ -118,7 +118,7 @@ function Projects(): ReactElement {
textAlign="center"
fontSize={["4xl", "5xl", "6xl"]}
py="3.5rem"
fontWeight={600}
fontWeight={500}
lineHeight={"100%"}
>
Featured Projects
Expand Down
2 changes: 1 addition & 1 deletion components/Landing/Tech.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Tech(): ReactElement {
<Heading
as="h3"
fontSize={["4xl", "5xl", "6xl"]}
fontWeight={600}
fontWeight={500}
lineHeight={"100%"}
mb="1.5rem"
>
Expand Down
24 changes: 5 additions & 19 deletions components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
"use client";

import React, { ReactElement, useState } from "react";
import Head from "next/head";
import { Waypoint } from "react-waypoint";

import MotionBox from "./MotionBox";
import Nav from "./Nav";
interface Props {
children: ReactElement[] | ReactElement;
title: string;
withAuth: boolean;
withAnimation: boolean;
withAnimation?: boolean;
}

const variants = {
hidden: { opacity: 0, x: 0, y: -100 },
enter: { opacity: 1, x: 0, y: 0 },
exit: { opacity: 0, x: 0, y: -100 },
};
function Layout({
children,
title,
withAuth,
withAnimation,
}: Props): ReactElement {

function Layout({ children, withAnimation = false }: Props): ReactElement {
const [isSticky, setIsSticky] = useState<boolean>(false);

const setSticky = () => {
Expand Down Expand Up @@ -52,9 +47,6 @@ function Layout({
exit="exit"
transition={{ type: "linear", duration: 0.45 }}
>
<Head>
<title>{title !== "" ? `Nishchay | ${title}` : "Nishchay"}</title>
</Head>
<Waypoint
onEnter={removeSticky}
onPositionChange={onWaypointPositionChange}
Expand All @@ -65,10 +57,4 @@ function Layout({
);
}

Layout.defaultProps = {
title: "",
withAuth: false,
withAnimation: true,
};

export default Layout;
2 changes: 2 additions & 0 deletions components/MotionBox.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import React, { ReactElement } from "react";
import { Box, BoxProps } from "@chakra-ui/layout";
import { motion } from "framer-motion";
Expand Down
Loading
Loading