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.
feat: add basic About page with skill display
- Loading branch information
1 parent
069d56d
commit e6a48fe
Showing
11 changed files
with
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { PortableText } from '@portabletext/react'; | ||
import Image from 'next/image'; | ||
import * as React from 'react'; | ||
|
||
import { skillQuery } from '@/queries/skills'; | ||
|
||
import { sanityClient } from '../../../../sanity/lib/client'; | ||
|
||
import { Skill } from '@/types/Skill'; | ||
import { SkillIcon } from '@/types/SkillIcon'; | ||
|
||
const getData = async () => { | ||
const skills: Skill[] = await sanityClient.fetch(skillQuery); | ||
|
||
return { | ||
skills, | ||
}; | ||
}; | ||
|
||
const AboutPage = async () => { | ||
const { skills } = await getData(); | ||
|
||
const iconDimension = 36; | ||
|
||
return ( | ||
<main className='min-h-main'> | ||
<section> | ||
<div className='layout relative flex flex-col py-12'> | ||
<h1 className='mb-5'>About</h1> | ||
|
||
<div className='grid grid-cols-1 gap-5 md:grid-cols-3 md:gap-10'> | ||
{skills.map((skill: Skill) => ( | ||
<div key={skill.name} className='skill-container'> | ||
<div className='flex'> | ||
{skill.icons.map((icon: SkillIcon) => ( | ||
<Image | ||
key={icon._id} | ||
height={iconDimension} | ||
width={iconDimension} | ||
alt={icon.title} | ||
src={icon.url} | ||
/> | ||
))} | ||
</div> | ||
|
||
<h3>{skill.title}</h3> | ||
|
||
<span className='skill-description text-justify font-light'> | ||
<PortableText value={skill.description} /> | ||
</span> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</section> | ||
</main> | ||
); | ||
}; | ||
|
||
export default AboutPage; |
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,15 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
import { skillIconQuery } from '@/queries/skill-icons'; | ||
|
||
import { sanityClient } from '../../../sanity/lib/client'; | ||
|
||
import { SkillIcon } from '@/types/SkillIcon'; | ||
|
||
const skillIconsApi = async (req: NextApiRequest, res: NextApiResponse) => { | ||
const skillIcons: SkillIcon[] = await sanityClient.fetch(skillIconQuery); | ||
|
||
res.status(200).json(skillIcons); | ||
}; | ||
|
||
export default skillIconsApi; |
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,4 @@ | ||
import { groq } from 'next-sanity'; | ||
|
||
export const skillIconQuery = groq` | ||
*[_type == "skillIcon"]`; |
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { TypedObject } from '@portabletext/types'; | ||
|
||
import { SkillIcon } from '@/types/SkillIcon'; | ||
|
||
export interface Skill { | ||
name: string; | ||
title: string; | ||
description: string; | ||
description: TypedObject; | ||
icons: SkillIcon[]; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface SkillIcon { | ||
_id: string; | ||
title: string; | ||
url: string; | ||
} |
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