Skip to content

Commit

Permalink
Merge pull request #62 from Nischal2015/feat/projects
Browse files Browse the repository at this point in the history
BREAKING CHANGE: add projects page
  • Loading branch information
Nischal2015 authored Aug 23, 2023
2 parents d568561 + b6d9618 commit 69ef280
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ declare module 'astro:content' {
collection: "seo",
data: InferEntrySchema<"seo">
} & { render(): Render[".md"] },
"projects.md": {
id: "projects.md",
slug: "projects",
body: string,
collection: "seo",
data: InferEntrySchema<"seo">
} & { render(): Render[".md"] },
},

};
Expand Down
81 changes: 76 additions & 5 deletions src/components/molecules/list.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { AchievementProps } from '../../types';
import { calculateMonths, skillBuilder } from '../../utils';
import { skillBuilder } from '../../utils';
const {
title,
Expand All @@ -19,7 +19,6 @@ const {
index,
} = Astro.props as AchievementProps & { index: number };
const duration = calculateMonths(startMonth, startYear, endMonth, endYear);
const skillsList = skillBuilder(skills);
---

Expand All @@ -39,12 +38,84 @@ const skillsList = skillBuilder(skills);
)
}
{education && <span>{education}</span>}
<span class='text-gray'
<span class='text-gray' id={`duration-${index}`}
>{startMonth}
{startYear} - {endMonth}
{endYear}
{company && duration && `· ${duration}`}</span
{endYear} ·
</span>

<script
define:vars={{
startMonth,
startYear,
endMonth,
endYear,
company,
index,
}}
>
const monthToNumber = {
Jan: 1,
Feb: 2,
Mar: 3,
Apr: 4,
May: 5,
Jun: 6,
Jul: 7,
Aug: 8,
Sep: 9,
Oct: 10,
Nov: 11,
Dec: 12,
};

const _resolveEndMonth = (endMonth, endYear) => {
if (endMonth && endYear) {
return +endYear * 12 + monthToNumber[endMonth];
}

const date = new Date();
const currentMonth = date.getMonth() + 1;
const currentYear = date.getFullYear();
return currentYear * 12 + currentMonth;
};

const monthToYearAndMonths = (value) => {
const year = Math.floor(value / 12);
const month = value % 12;
return { year, month };
};

const calculateMonths = (startMonth, startYear, endMonth, endYear) => {
const startMonthNumber = monthToNumber[startMonth];
const numberOfMonths =
_resolveEndMonth(endMonth, endYear) -
(+startYear * 12 + startMonthNumber) +
1;

const { year, month } = monthToYearAndMonths(numberOfMonths);

if (year === 0) {
return `${month} mos`;
} else if (year === 1) {
return `${year} yr ${month} mos`;
} else {
return `${year} yrs ${month} mos`;
}
};

const duration = calculateMonths(
startMonth,
startYear,
endMonth,
endYear
);
if (company && duration) {
const durationElement = document.getElementById(`duration-${index}`);
const text = document.createTextNode(duration);
durationElement.appendChild(text);
}
</script>
{
companyLocation && (
<span class='text-gray'>
Expand Down
13 changes: 13 additions & 0 deletions src/content/seo/projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
robots: 'index, follow'
title: 'Projects - Nischal Shakya'
description: 'Explore a captivating assortment of showcased projects that exemplify creativity, innovation, and dedication. Uncover a journey of problem-solving and skillful execution, all within a single portfolio.'
socialTitle: "Discovering Nischal's Portfolio: Unveiling a Collection of Creative Endeavors"
socialDescription: 'Dive into my dynamic portfolio! Unveil a world of creativity, innovation, and skill execution. Join me as we journey impactful projects together.'
socialImage: 'https://res.cloudinary.com/dt7uxtenl/image/upload/v1692756548/articles_zslydl.jpg'
socialImageAlt: 'Photo by Brands&People on Unsplash'
ogType: 'website'
ogUrl: 'https://nischalshakya.vercel.app/projects/'
twitterCard: 'summary_large_image'
twitterCreator: '@nischalshakya21'
---
145 changes: 145 additions & 0 deletions src/pages/projects.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
import { frontmatter } from '../content/seo/projects.md';
import PageLayout from '../layouts/page-layout.astro';
import Section from '../layouts/section.astro';
---

<PageLayout meta={frontmatter}>
<Section>
<h1 class='text-center'>Projects</h1>
<h2 class='text-center text-display-small tracking-wide text-gray mt-4 h2'>
Where Ideas Come to Life
</h2>

<div class='tablet'>
<div class='circle'></div>
<div class='screen'></div>
</div>
<div class='text'>
<span class='nothing'>NOTING!!</span>
<span class='empty'>Your collection list is empty.</span>
</div>
</Section>
</PageLayout>

<style>
.h2 {
margin-block-start: 0.8rem;
margin-block-end: 9.6rem;
}
.tablet {
height: 54rem;
width: 36rem;
background: #999;
border-radius: 8px;
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
position: relative;
margin: 0 auto;
filter: blur(0.75px);
}
.tablet:before,
.tablet:after {
content: '';
position: absolute;
bottom: 6rem;
height: 65%;
width: 45%;
background: #999;
clip-path: polygon(
12% 0,
100% 0,
100% 100%,
0 100%,
15% 33%,
0 13%,
18% 13%
);
}
.tablet:before {
transform: translateX(calc(-100% - 12px));
}
.tablet:after {
right: 0;
transform: scaleX(-1) translateX(calc(-100% + 3px));
}
.circle {
height: 18px;
width: 18px;
background: #fff;
border-radius: 50%;
box-shadow: 25px 0 0 0 #fff, 50px 0 0 0 #fff;
position: relative;
}
.circle:before,
.circle:after {
content: '';
position: absolute;
height: 60px;
width: 60px;
border-radius: 50%;
background: #fff;
top: 20rem;
z-index: 1;
box-shadow: inset 0 0 0 8px #888;
}
.circle:before {
left: -18.5rem;
}
.circle:after {
left: 45.5rem;
}
.screen {
height: 100%;
width: 100%;
background: #fff;
border-radius: 2px;
position: relative;
}
.screen:before,
.screen:after {
content: '';
position: absolute;
background: #999;
height: 18px;
right: 0;
left: 0;
margin-inline: auto;
}
.screen:before {
width: 18px;
box-shadow: 100px 0 0 0 #999;
border-radius: 50%;
transform: translateX(-50px);
margin-block-start: 85px;
}
.screen:after {
height: 14px;
width: 65px;
border-radius: 999px;
margin-block-start: 140px;
}
.text {
display: flex;
flex-direction: column;
margin-block-start: 6.4rem;
gap: 2.4rem;
filter: blur(0.75px);
}
.nothing,
.empty {
font-weight: 500;
text-align: center;
display: block;
color: #777;
letter-spacing: 1px;
}
.nothing {
font-size: 7.2rem;
}
.empty {
font-size: 3.6rem;
}
</style>

1 comment on commit 69ef280

@vercel
Copy link

@vercel vercel bot commented on 69ef280 Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nischalshakya – ./

nischalshakya-nischal2015.vercel.app
nischalshakya.vercel.app
nischalshakya-git-main-nischal2015.vercel.app

Please sign in to comment.