2021-06-24 19:46:44 +02:00
|
|
|
import { useTheme } from 'next-themes'
|
2021-04-18 01:56:23 +02:00
|
|
|
import Image from 'next/image'
|
2021-06-24 19:46:44 +02:00
|
|
|
import { useMemo } from 'react'
|
2021-04-18 01:56:23 +02:00
|
|
|
|
|
|
|
import { skills } from './skills'
|
|
|
|
|
2021-06-24 19:46:44 +02:00
|
|
|
export interface SkillComponentProps {
|
|
|
|
skill: string
|
2021-04-18 01:56:23 +02:00
|
|
|
}
|
|
|
|
|
2021-06-24 19:46:44 +02:00
|
|
|
export const SkillComponent: React.FC<SkillComponentProps> = (props) => {
|
2021-04-18 01:56:23 +02:00
|
|
|
const { skill } = props
|
|
|
|
const skillProperties = skills[skill]
|
2021-06-24 19:46:44 +02:00
|
|
|
const { theme } = useTheme()
|
|
|
|
|
|
|
|
const image = useMemo(() => {
|
|
|
|
if (typeof skillProperties.image !== 'string') {
|
|
|
|
return skillProperties.image[theme ?? 'light']
|
|
|
|
}
|
|
|
|
return skillProperties.image
|
|
|
|
}, [skillProperties, theme])
|
2021-04-18 01:56:23 +02:00
|
|
|
|
|
|
|
return (
|
2021-05-08 19:52:04 +02:00
|
|
|
<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'>
|
2022-02-22 21:19:42 +01:00
|
|
|
<Image quality={100} width={60} height={60} alt={skill} src={image} />
|
2021-05-08 19:52:04 +02:00
|
|
|
<p className='mt-1'>{skill}</p>
|
|
|
|
</div>
|
|
|
|
</a>
|
2021-04-18 01:56:23 +02:00
|
|
|
)
|
|
|
|
}
|