1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-11-05 13:01:30 +01:00
.profile/components/Skills/Skill.tsx
2022-02-22 21:19:42 +01:00

37 lines
954 B
TypeScript

import { useTheme } from 'next-themes'
import Image from 'next/image'
import { useMemo } from 'react'
import { skills } from './skills'
export interface SkillComponentProps {
skill: string
}
export const SkillComponent: React.FC<SkillComponentProps> = (props) => {
const { skill } = props
const skillProperties = skills[skill]
const { theme } = useTheme()
const image = useMemo(() => {
if (typeof skillProperties.image !== 'string') {
return skillProperties.image[theme ?? 'light']
}
return skillProperties.image
}, [skillProperties, theme])
return (
<a
href={skillProperties.link}
className='mx-2 max-w-xl text-yellow hover:underline dark:text-yellow-dark'
target='_blank'
rel='noopener noreferrer'
>
<div className='text-center'>
<Image quality={100} width={60} height={60} alt={skill} src={image} />
<p className='mt-1'>{skill}</p>
</div>
</a>
)
}