generated from theodorusclarence/ts-nextjs-tailwind-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from martapanc/feat/home
Feat/home
- Loading branch information
Showing
18 changed files
with
471 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
'use client'; | ||
|
||
import { useTheme } from 'next-themes'; | ||
import React, { useEffect, useState } from 'react'; | ||
import SyntaxHighlighter from 'react-syntax-highlighter'; | ||
import { | ||
atomOneLight, | ||
darcula, | ||
} from 'react-syntax-highlighter/dist/cjs/styles/hljs'; | ||
import Typed, { TypedOptions } from 'typed.js'; | ||
|
||
import { CodeSnippet } from '@/types/CodeSnippet'; | ||
|
||
export interface CodeSnippetsProps { | ||
codeSnippets: CodeSnippet[]; | ||
} | ||
|
||
const Code = ({ codeSnippets }: CodeSnippetsProps) => { | ||
const [loading, setLoading] = useState(true); | ||
|
||
const { theme } = useTheme(); | ||
|
||
const ideStyle = theme === 'dark' ? darcula : atomOneLight; | ||
|
||
useEffect(() => { | ||
setTimeout(() => { | ||
setLoading(false); | ||
}, 2000); | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (!loading) { | ||
const typedStringsElement = document.getElementById('typed-strings'); | ||
const typedElement = document.getElementById('typed'); | ||
|
||
if (typedStringsElement && typedElement) { | ||
const typedOptions: TypedOptions = { | ||
stringsElement: '#typed-strings', | ||
typeSpeed: 40, | ||
backSpeed: 10, | ||
backDelay: 5000, | ||
loop: true, | ||
loopCount: 0, | ||
smartBackspace: true, | ||
showCursor: true, | ||
cursorChar: '_', | ||
}; | ||
|
||
const typed = new Typed(typedElement, typedOptions); | ||
|
||
// Clean up the Typed.js instance when the component unmounts | ||
return () => { | ||
typed.destroy(); | ||
}; | ||
} | ||
} | ||
}, [loading]); | ||
|
||
return ( | ||
<div className='me-4 h-56 w-full rounded border-double bg-slate-200 px-4 py-6 dark:bg-slate-800 md:h-[280px] md:w-1/2'> | ||
<div id='typed-strings'> | ||
{loading ? <span className='cursor-blink'>_</span> : null} | ||
{!loading && | ||
codeSnippets.map((snippet) => ( | ||
<SyntaxHighlighter | ||
className='text-xs md:text-base' | ||
key={snippet._id} | ||
language={snippet.language} | ||
style={ideStyle} | ||
wrapLongLines={true} | ||
> | ||
{snippet.code} | ||
</SyntaxHighlighter> | ||
))} | ||
</div> | ||
<span id='typed'></span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Code; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
import { shuffleArray } from '@/lib/helper'; | ||
|
||
import Code, { CodeSnippetsProps } from '@/components/organisms/home/Code'; | ||
import Photo from '@/components/organisms/home/Photo'; | ||
|
||
const Intro = ({ codeSnippets }: CodeSnippetsProps) => { | ||
return ( | ||
<div className='mb-6 flex h-fit flex-col pb-6 md:h-96'> | ||
<h1 className='pb-4 text-5xl antialiased'>Hey there, I'm Marta 👋🏻</h1> | ||
|
||
<div className='mt-8 flex flex-col md:flex-row'> | ||
<Code codeSnippets={shuffleArray(codeSnippets)} /> | ||
|
||
<Photo /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Intro; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
|
||
const Photo = () => { | ||
return ( | ||
<div className='flex h-80 w-full justify-start md:h-[280px] md:w-1/2 md:justify-end'> | ||
<div className='ms-3 flex flex-row-reverse p-3 md:flex-row'> | ||
<div className='me-6 flex flex-col items-end text-lg'> | ||
<div className='mt-10'>Software Engineer</div> | ||
<div className='mt-10'>Lifelong learner</div> | ||
<div className='mt-10'>Remote work enthusiast</div> | ||
</div> | ||
<div className='flex flex-col items-center'> | ||
<Image | ||
className='mb-3 rounded-full' | ||
src='https://cdn.sanity.io/images/lj8a3h3g/production/15c9b3d57800e2f07abb0f6971a9186f9ff54f68-553x553.png' | ||
alt='Avatar' | ||
width={190} | ||
height={0} | ||
style={{ height: '190px' }} | ||
/> | ||
<Image | ||
src='https://cdn.sanity.io/images/lj8a3h3g/production/b1fbe23d8efef11db38fd636e4035db81cfebdf6-941x189.webp' | ||
alt='Avatar' | ||
width={250} | ||
height={0} | ||
style={{ height: '50px' }} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Photo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
|
||
const Summary = () => { | ||
return ( | ||
<> | ||
<div className='pb-4 text-base antialiased'> | ||
I'm a software engineer based in Turin, Italy, and I am currently | ||
working at | ||
<a | ||
href='https://resourcify.com/' | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
> | ||
<Image | ||
className='ms-2 inline' | ||
src='https://cdn.sanity.io/images/lj8a3h3g/production/c0f36368549d879ad790c46fd32f7ea10e3e258f-600x115.webp' | ||
alt='Resourcify' | ||
width='110' | ||
height='25' | ||
/> | ||
</a> | ||
. | ||
</div> | ||
|
||
<p className='pb-4 text-base antialiased'> | ||
I hold a MSc in Advanced Computer Science from the University of | ||
Manchester, and have four years of experience at | ||
<a href='https://bjss.com/' target='_blank' rel='noopener noreferrer'> | ||
<Image | ||
className='mx-2 inline' | ||
src='https://cdn.sanity.io/images/lj8a3h3g/production/0c8cfb9083cafb314b46b195ab99a27daf2f639d-280x150.webp' | ||
alt='BJSS' | ||
width='45' | ||
height='25' | ||
/> | ||
</a> | ||
and | ||
<a | ||
href='https://booking.com/' | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
> | ||
<Image | ||
className='ms-2 inline' | ||
src='https://cdn.sanity.io/images/lj8a3h3g/production/a9bb3876e39ba378769bcc9b881ad8860dcbb9df-2500x424.svg' | ||
alt='Booking.com' | ||
width='115' | ||
height='25' | ||
/> | ||
</a> | ||
. | ||
</p> | ||
|
||
<p className='pb-4 text-base antialiased'> | ||
My skill set embraces a range of programming languages, including Java, | ||
Kotlin, Python, C# and TypeScript, as well as frontend frameworks such | ||
as React and Angular. | ||
</p> | ||
|
||
<p className='pb-4 text-base antialiased'> | ||
While I have a solid foundation in backend development, my heart truly | ||
lies in the exciting realm of full-stack engineering. | ||
</p> | ||
|
||
<p className='pb-4 text-base antialiased'> | ||
In my free time, I’m a fiction writer, an avid bookworm, an oboist and | ||
alto singer, and a travel photographer. | ||
</p> | ||
</> | ||
); | ||
}; | ||
|
||
export default Summary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
import { codeSnippetsQuery } from '@/queries/codeSnippets'; | ||
|
||
import { sanityClient } from '../../../sanity/lib/client'; | ||
|
||
import { CodeSnippet } from '@/types/CodeSnippet'; | ||
|
||
const codeSnippetsApi = async (req: NextApiRequest, res: NextApiResponse) => { | ||
const codeSnippets: CodeSnippet[] = await sanityClient.fetch( | ||
codeSnippetsQuery | ||
); | ||
|
||
res.status(200).json({ | ||
codeSnippets, | ||
}); | ||
}; | ||
|
||
export default codeSnippetsApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
import { homeContentQuery } from '@/queries/homeContent'; | ||
|
||
import { sanityClient } from '../../../sanity/lib/client'; | ||
|
||
import { HomeContent } from '@/types/HomeContent'; | ||
|
||
const homeApi = async (req: NextApiRequest, res: NextApiResponse) => { | ||
const homeContent: HomeContent = await sanityClient.fetch(homeContentQuery); | ||
|
||
res.status(200).json({ | ||
home: homeContent, | ||
}); | ||
}; | ||
|
||
export default homeApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { groq } from 'next-sanity'; | ||
|
||
export const codeSnippetsQuery = groq` | ||
*[_type == "codeSnippet"] { | ||
_id, | ||
title, | ||
"code": code.code, | ||
"language": code.language, | ||
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { groq } from 'next-sanity'; | ||
|
||
export const homeContentQuery = groq` | ||
*[_type == "homeContent"] { | ||
_id, | ||
title, | ||
threeLineSummary, | ||
summary0, | ||
summary1, | ||
summary2, | ||
summary3, | ||
summary4, | ||
}`; |
Oops, something went wrong.
c3ce299
There was a problem hiding this comment.
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:
martacodes-it – ./
martacodes.it
martacodes-it-martapanc.vercel.app
martacodes-it-git-master-martapanc.vercel.app
www.martacodes.it
martacodes-it.vercel.app