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: extract SkillCard and display first 3 skills
- Loading branch information
Showing
5 changed files
with
96 additions
and
34 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,43 @@ | ||
'use client'; | ||
|
||
import Image from 'next/image'; | ||
import * as React from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
|
||
import { Icon } from '@/types/Icon'; | ||
import { Skill } from '@/types/Skill'; | ||
|
||
export interface SkillCardProps { | ||
skill: Skill; | ||
} | ||
const SkillCard = ({ skill }: SkillCardProps) => { | ||
const iconDimension = 36; | ||
|
||
return ( | ||
<div | ||
key={skill.title} | ||
className='skill-container rounded p-4 shadow-md dark:bg-slate-900 dark:drop-shadow-md' | ||
> | ||
<div className='flex w-full'> | ||
{skill.icons.map((icon: Icon) => ( | ||
<Image | ||
className='me-1 pb-1 rounded-md' | ||
key={icon.id} | ||
height={iconDimension} | ||
width={iconDimension} | ||
alt={icon.name} | ||
src={icon.url} | ||
/> | ||
))} | ||
</div> | ||
|
||
<h3>{skill.title}</h3> | ||
|
||
<span className='skill-description text-justify font-light'> | ||
<ReactMarkdown>{skill.description}</ReactMarkdown> | ||
</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SkillCard; |
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,46 @@ | ||
'use client'; | ||
|
||
import * as React from 'react'; | ||
import { useState } from 'react'; | ||
|
||
import Button from '@/components/atoms/buttons/Button'; | ||
import SkillCard from '@/components/molecules/SkillCard/SkillCard'; | ||
|
||
import { Skill } from '@/types/Skill'; | ||
|
||
export interface SkillsProps { | ||
skills: Skill[]; | ||
} | ||
|
||
const Skills = ({ skills }: SkillsProps) => { | ||
const initialDisplayCount = 3; // Number of items to initially display | ||
const [showAllSkills, setShowAllSkills] = useState(false); | ||
|
||
const displayedSkills = showAllSkills | ||
? skills | ||
: skills.slice(0, initialDisplayCount); | ||
|
||
const toggleShowAllSkills = () => { | ||
setShowAllSkills(!showAllSkills); | ||
}; | ||
|
||
return ( | ||
<div className='mb-4'> | ||
<div className='mb-10 grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3 lg:gap-6'> | ||
{displayedSkills.map((skill: Skill) => ( | ||
<SkillCard skill={skill} key={skill.title} /> | ||
))} | ||
</div> | ||
|
||
{!showAllSkills && skills.length > initialDisplayCount && ( | ||
<div className='flex w-full justify-end px-4'> | ||
<Button color='dark' onClick={toggleShowAllSkills}> | ||
Show more | ||
</Button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Skills; |
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 |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
.job-content li { | ||
margin-bottom: 6px !important; | ||
} | ||
|
||
.cv-intro-section p { | ||
margin-bottom: 5px; | ||
} |