1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-12-08 00:44:30 +01:00

refactor: 'use client' when appropriate

This commit is contained in:
Théo LUDWIG 2023-07-30 18:50:14 +02:00
parent 70603f1444
commit 6d0dcb50a7
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
11 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,5 @@
'use client'
import { useCallback, useEffect, useState, useRef } from 'react' import { useCallback, useEffect, useState, useRef } from 'react'
import useTranslation from 'next-translate/useTranslation' import useTranslation from 'next-translate/useTranslation'
import setLanguage from 'next-translate/setLanguage' import setLanguage from 'next-translate/setLanguage'
@ -61,7 +63,7 @@ export const Language: React.FC = () => {
> >
{i18n.locales.map((language, index) => { {i18n.locales.map((language, index) => {
if (language === currentLanguage) { if (language === currentLanguage) {
return null return <></>
} }
return ( return (
<li <li

View File

@ -1,3 +1,5 @@
'use client'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import classNames from 'clsx' import classNames from 'clsx'
import { useTheme } from 'next-themes' import { useTheme } from 'next-themes'

View File

@ -1,5 +1,5 @@
import { ShadowContainer } from 'components/design/ShadowContainer' import { ShadowContainer } from '@/components/design/ShadowContainer'
import { GitHubIcon } from 'components/Profile/SocialMediaList/SocialMediaIcons/GitHubIcon' import { GitHubIcon } from '@/components/Profile/SocialMediaList/SocialMediaIcons/GitHubIcon'
export interface RepositoryProps { export interface RepositoryProps {
name: string name: string

View File

@ -11,7 +11,7 @@ export const OpenSource: React.FC = () => {
<div className='my-6 grid grid-cols-1 gap-6 md:w-10/12 md:grid-cols-2'> <div className='my-6 grid grid-cols-1 gap-6 md:w-10/12 md:grid-cols-2'>
<Repository <Repository
name='nodejs/node' name='nodejs/node'
description='Node.js JavaScript runtime 🐢🚀' description='Node.js JavaScript runtime 🐢🚀'
href='https://github.com/nodejs/node/commits?author=theoludwig' href='https://github.com/nodejs/node/commits?author=theoludwig'
/> />
<Repository <Repository
@ -21,12 +21,12 @@ export const OpenSource: React.FC = () => {
/> />
<Repository <Repository
name='nrwl/nx' name='nrwl/nx'
description='Smart, Extensible Build Framework' description='Smart, Fast and Extensible Build System'
href='https://github.com/nrwl/nx/commits?author=theoludwig' href='https://github.com/nrwl/nx/commits?author=theoludwig'
/> />
<Repository <Repository
name='vercel/next.js' name='vercel/next.js'
description='The React Framework for Production' description='The React Framework'
href='https://github.com/vercel/next.js/commits?author=theoludwig' href='https://github.com/vercel/next.js/commits?author=theoludwig'
/> />
</div> </div>

View File

@ -1,6 +1,6 @@
import Image from 'next/image' import Image from 'next/image'
import { ShadowContainer } from 'components/design/ShadowContainer' import { ShadowContainer } from '@/components/design/ShadowContainer'
export interface PortfolioItemProps { export interface PortfolioItemProps {
title: string title: string

View File

@ -1,7 +1,9 @@
'use client'
import useTranslation from 'next-translate/useTranslation' import useTranslation from 'next-translate/useTranslation'
import { useMemo } from 'react' import { useMemo } from 'react'
import { BIRTH_DATE, BIRTH_DATE_STRING, getAge } from 'utils/getAge' import { BIRTH_DATE, BIRTH_DATE_STRING, getAge } from '@/utils/getAge'
import { ProfileItem } from './ProfileItem' import { ProfileItem } from './ProfileItem'

View File

@ -16,7 +16,7 @@ export const SocialMediaList: React.FC = () => {
<SocialMediaItem link='https://gitlab.com/theoludwig' ariaLabel='GitLab'> <SocialMediaItem link='https://gitlab.com/theoludwig' ariaLabel='GitLab'>
<GitLabIcon /> <GitLabIcon />
</SocialMediaItem> </SocialMediaItem>
<SocialMediaItem link='https://www.npmjs.com/~theoludwig' ariaLabel='NPM'> <SocialMediaItem link='https://www.npmjs.com/~theoludwig' ariaLabel='npm'>
<NPMIcon /> <NPMIcon />
</SocialMediaItem> </SocialMediaItem>
<SocialMediaItem <SocialMediaItem

View File

@ -1,4 +1,4 @@
import { ShadowContainer } from 'components/design/ShadowContainer' import { ShadowContainer } from '@/components/design/ShadowContainer'
export interface SkillsSectionProps { export interface SkillsSectionProps {
title: string title: string

View File

@ -1,3 +1,5 @@
'use client'
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
export const RevealFade: React.FC<React.PropsWithChildren> = (props) => { export const RevealFade: React.FC<React.PropsWithChildren> = (props) => {

View File

@ -1,5 +1,5 @@
import { ShadowContainer } from '../ShadowContainer' import { ShadowContainer } from '@/components/design/ShadowContainer'
import { SectionHeading } from './SectionHeading' import { SectionHeading } from '@/components/design/Section/SectionHeading'
type SectionProps = React.ComponentPropsWithRef<'section'> & { type SectionProps = React.ComponentPropsWithRef<'section'> & {
heading?: string heading?: string

View File

@ -1,4 +1,4 @@
import { getAge } from '../../../utils/getAge' import { getAge } from '@/utils/getAge'
describe('utils/getAge', () => { describe('utils/getAge', () => {
it('should calculate the right age of a person', () => { it('should calculate the right age of a person', () => {