1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

feat: rewrite to Next.js v13 app directory

Improvements:
- Hide switch theme input (ugly little white square)
- i18n without subpath (e.g: /fr or /en), same url whatever the locale used
This commit is contained in:
2023-07-31 19:06:46 +02:00
parent 5640f1b434
commit 6b29ce9b15
61 changed files with 755 additions and 787 deletions

View File

@ -1,6 +1,8 @@
'use client'
import { useState, useEffect, useMemo } from 'react'
import { useTheme } from 'next-themes'
import Image from 'next/image'
import { useMemo } from 'react'
import type { SkillName } from './skills'
import { skills } from './skills'
@ -11,18 +13,31 @@ export interface SkillComponentProps {
export const SkillComponent: React.FC<SkillComponentProps> = (props) => {
const { skill } = props
const skillProperties = skills[skill]
const [mounted, setMounted] = useState(false)
const { theme } = useTheme()
useEffect(() => {
setMounted(true)
}, [])
const image = useMemo(() => {
if (typeof skillProperties.image === 'string') {
return skillProperties.image
}
if (!mounted) {
return skillProperties.image.dark
}
if (theme === 'light') {
return skillProperties.image.light
}
return skillProperties.image.dark
}, [skillProperties, theme])
}, [skillProperties, theme, mounted])
if (!mounted) {
return null
}
return (
<a

View File

@ -1,14 +1,14 @@
import useTranslation from 'next-translate/useTranslation'
import { getI18n } from '@/i18n/i18n.server'
import { SkillComponent } from './Skill'
import { SkillsSection } from './SkillsSection'
export const Skills: React.FC = () => {
const { t } = useTranslation()
const i18n = getI18n()
return (
<>
<SkillsSection title={t('home:skills.languages')}>
<SkillsSection title={i18n.translate('home.skills.languages')}>
<SkillComponent skill='TypeScript' />
<SkillComponent skill='Python' />
<SkillComponent skill='C/C++' />
@ -29,7 +29,7 @@ export const Skills: React.FC = () => {
<SkillComponent skill='PostgreSQL' />
</SkillsSection>
<SkillsSection title={t('home:skills.software-tools')}>
<SkillsSection title={i18n.translate('home.skills.software-tools')}>
<SkillComponent skill='GNU/Linux' />
<SkillComponent skill='Arch Linux' />
<SkillComponent skill='Visual Studio Code' />