1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-11-09 14:51:30 +01:00

refactor: avoid usage of React.FC to use JSX.Element (to stay consistent)

This commit is contained in:
Théo LUDWIG 2023-08-01 17:22:09 +02:00
parent 4b2e7bae90
commit 2e0138194c
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
34 changed files with 51 additions and 37 deletions

View File

@ -7,7 +7,7 @@ export interface ErrorPageProps {
message: string message: string
} }
export const ErrorPage: React.FC<ErrorPageProps> = (props) => { export const ErrorPage = (props: ErrorPageProps): JSX.Element => {
const { message, statusCode } = props const { message, statusCode } = props
const i18n = getI18n() const i18n = getI18n()

View File

@ -1,4 +1,4 @@
export const Arrow: React.FC = () => { export const Arrow = (): JSX.Element => {
return ( return (
<svg <svg
width='12' width='12'

View File

@ -8,7 +8,7 @@ export interface LocaleFlagProps {
cookiesStore: CookiesStore cookiesStore: CookiesStore
} }
export const LocaleFlag: React.FC<LocaleFlagProps> = (props) => { export const LocaleFlag = (props: LocaleFlagProps): JSX.Element => {
const { locale, cookiesStore } = props const { locale, cookiesStore } = props
const i18n = useI18n(cookiesStore) const i18n = useI18n(cookiesStore)

View File

@ -5,7 +5,9 @@ export interface InterestParagraphProps {
description: string description: string
} }
export const InterestParagraph: React.FC<InterestParagraphProps> = (props) => { export const InterestParagraph = (
props: InterestParagraphProps
): JSX.Element => {
const { title, description } = props const { title, description } = props
return ( return (

View File

@ -6,7 +6,7 @@ interface InterestItemProps {
fontAwesomeIcon: IconDefinition fontAwesomeIcon: IconDefinition
} }
export const InterestItem: React.FC<InterestItemProps> = (props) => { export const InterestItem = (props: InterestItemProps): JSX.Element => {
const { fontAwesomeIcon, title } = props const { fontAwesomeIcon, title } = props
return ( return (

View File

@ -3,7 +3,7 @@ import { faGit } from '@fortawesome/free-brands-svg-icons'
import { InterestItem } from './InterestItem' import { InterestItem } from './InterestItem'
export const InterestsList: React.FC = () => { export const InterestsList = (): JSX.Element => {
return ( return (
<div className='my-4 flex justify-center'> <div className='my-4 flex justify-center'>
<ul className='m-0 flex w-96 list-none justify-around p-0'> <ul className='m-0 flex w-96 list-none justify-around p-0'>

View File

@ -4,7 +4,7 @@ import type { InterestParagraphProps } from './InterestParagraph'
import { InterestParagraph } from './InterestParagraph' import { InterestParagraph } from './InterestParagraph'
import { InterestsList } from './InterestsList' import { InterestsList } from './InterestsList'
export const Interests: React.FC = () => { export const Interests = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
let paragraphs = i18n.translate<InterestParagraphProps[]>( let paragraphs = i18n.translate<InterestParagraphProps[]>(

View File

@ -6,7 +6,7 @@ export interface LoaderProps {
className?: string className?: string
} }
export const Loader: React.FC<LoaderProps> = (props) => { export const Loader = (props: LoaderProps): JSX.Element => {
const { width = 50, height = 50, className } = props const { width = 50, height = 50, className } = props
return ( return (

View File

@ -7,7 +7,7 @@ export interface RepositoryProps {
href: string href: string
} }
export const Repository: React.FC<RepositoryProps> = (props) => { export const Repository = (props: RepositoryProps): JSX.Element => {
const { name, description, href } = props const { name, description, href } = props
return ( return (

View File

@ -2,7 +2,7 @@ import { getI18n } from '@/i18n/i18n.server'
import { Repository } from './Repository' import { Repository } from './Repository'
export const OpenSource: React.FC = () => { export const OpenSource = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
return ( return (

View File

@ -9,7 +9,7 @@ export interface PortfolioItemProps {
image: string image: string
} }
export const PortfolioItem: React.FC<PortfolioItemProps> = (props) => { export const PortfolioItem = (props: PortfolioItemProps): JSX.Element => {
const { title, description, link, image } = props const { title, description, link, image } = props
return ( return (

View File

@ -3,7 +3,7 @@ import { getI18n } from '@/i18n/i18n.server'
import type { PortfolioItemProps } from './PortfolioItem' import type { PortfolioItemProps } from './PortfolioItem'
import { PortfolioItem } from './PortfolioItem' import { PortfolioItem } from './PortfolioItem'
export const Portfolio: React.FC = () => { export const Portfolio = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
let items = i18n.translate<PortfolioItemProps[]>('home.portfolio.items') let items = i18n.translate<PortfolioItemProps[]>('home.portfolio.items')

View File

@ -1,6 +1,6 @@
import { getI18n } from '@/i18n/i18n.server' import { getI18n } from '@/i18n/i18n.server'
export const ProfileDescriptionBottom: React.FC = () => { export const ProfileDescriptionBottom = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
return ( return (

View File

@ -1,6 +1,6 @@
import { getI18n } from '@/i18n/i18n.server' import { getI18n } from '@/i18n/i18n.server'
export const ProfileInformation: React.FC = () => { export const ProfileInformation = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
return ( return (

View File

@ -4,7 +4,7 @@ interface ProfileItemProps {
link?: string link?: string
} }
export const ProfileItem: React.FC<ProfileItemProps> = (props) => { export const ProfileItem = (props: ProfileItemProps): JSX.Element => {
const { title, value, link } = props const { title, value, link } = props
return ( return (

View File

@ -2,7 +2,7 @@ import Image from 'next/image'
import Logo from 'public/images/logo.png' import Logo from 'public/images/logo.png'
export const ProfileLogo: React.FC = () => { export const ProfileLogo = (): JSX.Element => {
return ( return (
<div className='max-h-[370px] max-w-[370px] px-2 py-6'> <div className='max-h-[370px] max-w-[370px] px-2 py-6'>
<Image quality={100} src={Logo} alt='Théo LUDWIG' priority /> <Image quality={100} src={Logo} alt='Théo LUDWIG' priority />

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const EmailIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const EmailIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>Email</title> <title>Email</title>

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const GitHubIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const GitHubIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>GitHub</title> <title>GitHub</title>

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const GitLabIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const GitLabIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>GitLab</title> <title>GitLab</title>

View File

@ -1,6 +1,6 @@
import classNames from 'clsx' import classNames from 'clsx'
export const Icon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const Icon = (props: React.SVGProps<SVGSVGElement>): JSX.Element => {
const { children, className, ...rest } = props const { children, className, ...rest } = props
return ( return (

View File

@ -1,6 +1,6 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const NPMIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const NPMIcon = (props: React.SVGProps<SVGSVGElement>): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>npm</title> <title>npm</title>

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const TwitchIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const TwitchIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>Twitch</title> <title>Twitch</title>

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const TwitterIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const TwitterIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>Twitter</title> <title>Twitter</title>

View File

@ -1,6 +1,8 @@
import { Icon } from './Icon' import { Icon } from './Icon'
export const YouTubeIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { export const YouTubeIcon = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
return ( return (
<Icon {...props}> <Icon {...props}>
<title>YouTube</title> <title>YouTube</title>

View File

@ -1,11 +1,9 @@
interface SocialMediaItemProps { interface SocialMediaItemProps extends React.PropsWithChildren {
link: string link: string
ariaLabel: string ariaLabel: string
} }
export const SocialMediaItem: React.FC< export const SocialMediaItem = (props: SocialMediaItemProps): JSX.Element => {
React.PropsWithChildren<SocialMediaItemProps>
> = (props) => {
const { link, ariaLabel, children } = props const { link, ariaLabel, children } = props
return ( return (

View File

@ -7,7 +7,7 @@ import { TwitchIcon } from './SocialMediaIcons/TwitchIcon'
import { EmailIcon } from './SocialMediaIcons/EmailIcon' import { EmailIcon } from './SocialMediaIcons/EmailIcon'
import { NPMIcon } from './SocialMediaIcons/NPMIcon' import { NPMIcon } from './SocialMediaIcons/NPMIcon'
export const SocialMediaList: React.FC = () => { export const SocialMediaList = (): JSX.Element => {
return ( return (
<ul className='social-media-list m-0 mt-2 list-none py-4 text-center'> <ul className='social-media-list m-0 mt-2 list-none py-4 text-center'>
<SocialMediaItem link='https://github.com/theoludwig' ariaLabel='GitHub'> <SocialMediaItem link='https://github.com/theoludwig' ariaLabel='GitHub'>

View File

@ -5,7 +5,7 @@ import { ProfileInformation } from './ProfileInfo'
import { ProfileList } from './ProfileList' import { ProfileList } from './ProfileList'
import { ProfileLogo } from './ProfileLogo' import { ProfileLogo } from './ProfileLogo'
export const Profile: React.FC = () => { export const Profile = (): JSX.Element => {
const cookiesStore = cookies() const cookiesStore = cookies()
return ( return (

View File

@ -9,7 +9,7 @@ export interface SkillComponentProps {
skill: SkillName skill: SkillName
} }
export const SkillComponent: React.FC<SkillComponentProps> = (props) => { export const SkillComponent = (props: SkillComponentProps): JSX.Element => {
const { skill } = props const { skill } = props
const skillProperties = skills[skill] const skillProperties = skills[skill]

View File

@ -5,7 +5,7 @@ export interface SkillsSectionProps {
children: React.ReactNode children: React.ReactNode
} }
export const SkillsSection: React.FC<SkillsSectionProps> = (props) => { export const SkillsSection = (props: SkillsSectionProps): JSX.Element => {
const { title, children } = props const { title, children } = props
return ( return (

View File

@ -3,7 +3,7 @@ import { getI18n } from '@/i18n/i18n.server'
import { SkillComponent } from './Skill' import { SkillComponent } from './Skill'
import { SkillsSection } from './SkillsSection' import { SkillsSection } from './SkillsSection'
export const Skills: React.FC = () => { export const Skills = (): JSX.Element => {
const i18n = getI18n() const i18n = getI18n()
return ( return (

View File

@ -2,7 +2,9 @@
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
export const RevealFade: React.FC<React.PropsWithChildren> = (props) => { export type RevealFadeProps = React.PropsWithChildren
export const RevealFade = (props: RevealFadeProps): JSX.Element => {
const { children } = props const { children } = props
const htmlElement = useRef<HTMLDivElement>(null) const htmlElement = useRef<HTMLDivElement>(null)

View File

@ -1,6 +1,6 @@
type SectionHeadingProps = React.ComponentPropsWithRef<'h2'> type SectionHeadingProps = React.ComponentPropsWithRef<'h2'>
export const SectionHeading: React.FC<SectionHeadingProps> = (props) => { export const SectionHeading = (props: SectionHeadingProps): JSX.Element => {
const { children, ...rest } = props const { children, ...rest } = props
return ( return (

View File

@ -8,7 +8,7 @@ type SectionProps = React.ComponentPropsWithRef<'section'> & {
withoutShadowContainer?: boolean withoutShadowContainer?: boolean
} }
export const Section: React.FC<SectionProps> = (props) => { export const Section = (props: SectionProps): JSX.Element => {
const { const {
children, children,
heading, heading,

View File

@ -2,7 +2,7 @@ import classNames from 'clsx'
type ShadowContainerProps = React.ComponentPropsWithRef<'div'> type ShadowContainerProps = React.ComponentPropsWithRef<'div'>
export const ShadowContainer: React.FC<ShadowContainerProps> = (props) => { export const ShadowContainer = (props: ShadowContainerProps): JSX.Element => {
const { children, className, ...rest } = props const { children, className, ...rest } = props
return ( return (