2023-10-23 23:11:59 +02:00
|
|
|
import Image from "next/image"
|
2021-04-18 01:56:23 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
import { getTheme } from "@/theme/theme.server"
|
2023-08-01 14:11:46 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
import type { SkillName } from "./skills"
|
|
|
|
import { skills } from "./skills"
|
2021-04-18 01:56:23 +02:00
|
|
|
|
2021-06-24 19:46:44 +02:00
|
|
|
export interface SkillComponentProps {
|
2022-10-20 22:24:01 +02:00
|
|
|
skill: SkillName
|
2021-04-18 01:56:23 +02:00
|
|
|
}
|
|
|
|
|
2023-08-01 17:22:09 +02:00
|
|
|
export const SkillComponent = (props: SkillComponentProps): JSX.Element => {
|
2021-04-18 01:56:23 +02:00
|
|
|
const { skill } = props
|
2023-07-31 19:06:46 +02:00
|
|
|
|
2021-04-18 01:56:23 +02:00
|
|
|
const skillProperties = skills[skill]
|
2021-06-24 19:46:44 +02:00
|
|
|
|
2023-08-01 14:11:46 +02:00
|
|
|
const theme = getTheme()
|
2023-07-31 19:06:46 +02:00
|
|
|
|
2023-08-01 14:11:46 +02:00
|
|
|
const getImage = (): string => {
|
2023-10-23 23:11:59 +02:00
|
|
|
if (typeof skillProperties.image === "string") {
|
2022-10-20 22:24:01 +02:00
|
|
|
return skillProperties.image
|
2021-06-24 19:46:44 +02:00
|
|
|
}
|
2023-10-23 23:11:59 +02:00
|
|
|
if (theme === "light") {
|
2022-10-20 22:24:01 +02:00
|
|
|
return skillProperties.image.light
|
|
|
|
}
|
|
|
|
return skillProperties.image.dark
|
2023-07-31 19:06:46 +02:00
|
|
|
}
|
2021-04-18 01:56:23 +02:00
|
|
|
|
|
|
|
return (
|
2021-05-08 19:52:04 +02:00
|
|
|
<a
|
|
|
|
href={skillProperties.link}
|
2024-04-06 20:25:02 +02:00
|
|
|
className="mx-2 max-w-xl text-primary hover:underline dark:text-primary-dark"
|
2023-10-23 23:11:59 +02:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2021-05-08 19:52:04 +02:00
|
|
|
>
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="text-center">
|
2022-10-27 19:13:29 +02:00
|
|
|
<Image
|
2024-01-28 03:21:11 +01:00
|
|
|
className="inline size-16"
|
2022-10-27 19:13:29 +02:00
|
|
|
quality={100}
|
2023-06-18 12:18:24 +02:00
|
|
|
width={64}
|
|
|
|
height={64}
|
2022-10-27 19:13:29 +02:00
|
|
|
alt={skill}
|
2023-08-01 14:11:46 +02:00
|
|
|
src={getImage()}
|
2022-10-27 19:13:29 +02:00
|
|
|
/>
|
2024-01-28 01:56:47 +01:00
|
|
|
<p className="mt-1 font-semibold">{skill}</p>
|
2021-05-08 19:52:04 +02:00
|
|
|
</div>
|
|
|
|
</a>
|
2021-04-18 01:56:23 +02:00
|
|
|
)
|
|
|
|
}
|