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

chore: better Prettier config for easier reviews

This commit is contained in:
2023-10-23 23:11:59 +02:00
parent c7ad15a465
commit e566ef6c38
105 changed files with 2138 additions and 2080 deletions

View File

@@ -1,15 +1,15 @@
export const Arrow = (): JSX.Element => {
return (
<svg
width='12'
height='8'
viewBox='0 0 12 8'
fill='none'
xmlns='http://www.w3.org/2000/svg'
width="12"
height="8"
viewBox="0 0 12 8"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
className='fill-current text-black dark:text-white'
d='M9.8024 0.292969L5.61855 4.58597L1.43469 0.292969L0.0566406 1.70697L5.61855 7.41397L11.1805 1.70697L9.8024 0.292969Z'
className="fill-current text-black dark:text-white"
d="M9.8024 0.292969L5.61855 4.58597L1.43469 0.292969L0.0566406 1.70697L5.61855 7.41397L11.1805 1.70697L9.8024 0.292969Z"
/>
</svg>
)

View File

@@ -1,7 +1,7 @@
import Image from 'next/image'
import Image from "next/image"
import type { CookiesStore } from '@/utils/constants'
import { useI18n } from '@/i18n/i18n.client'
import type { CookiesStore } from "@/utils/constants"
import { useI18n } from "@/i18n/i18n.client"
export interface LocaleFlagProps {
locale: string
@@ -22,7 +22,7 @@ export const LocaleFlag = (props: LocaleFlagProps): JSX.Element => {
src={`/images/locales/${locale}.svg`}
alt={locale}
/>
<p data-cy='locale-flag-text' className='mx-2 text-base'>
<p data-cy="locale-flag-text" className="mx-2 text-base">
{i18n.translate(`common.${locale}`)}
</p>
</>

View File

@@ -1,14 +1,14 @@
'use client'
"use client"
import { usePathname } from 'next/navigation'
import { useCallback, useEffect, useState, useRef } from 'react'
import classNames from 'clsx'
import { usePathname } from "next/navigation"
import { useCallback, useEffect, useState, useRef } from "react"
import classNames from "clsx"
import type { Locale as LocaleType, CookiesStore } from '@/utils/constants'
import { LOCALES } from '@/utils/constants'
import type { Locale as LocaleType, CookiesStore } from "@/utils/constants"
import { LOCALES } from "@/utils/constants"
import { Arrow } from './Arrow'
import { LocaleFlag } from './LocaleFlag'
import { Arrow } from "./Arrow"
import { LocaleFlag } from "./LocaleFlag"
export interface LocalesProps {
currentLocale: string
@@ -38,28 +38,28 @@ export const Locales = (props: LocalesProps): JSX.Element => {
}
}
window.document.addEventListener('click', handleClickEvent)
window.document.addEventListener("click", handleClickEvent)
return () => {
return window.removeEventListener('click', handleClickEvent)
return window.removeEventListener("click", handleClickEvent)
}
}, [])
const handleLocale = async (locale: LocaleType): Promise<void> => {
const { setLocale } = await import('@/i18n/i18n.server')
const { setLocale } = await import("@/i18n/i18n.server")
setLocale(locale)
}
if (pathname.startsWith('/blog')) {
if (pathname.startsWith("/blog")) {
return <></>
}
return (
<div className='flex cursor-pointer flex-col items-center justify-center'>
<div className="flex cursor-pointer flex-col items-center justify-center">
<div
ref={languageClickRef}
data-cy='locale-click'
className='mr-5 flex items-center'
data-cy="locale-click"
className="mr-5 flex items-center"
onClick={handleHiddenMenu}
>
<LocaleFlag
@@ -70,10 +70,10 @@ export const Locales = (props: LocalesProps): JSX.Element => {
</div>
<ul
data-cy='locales-list'
data-cy="locales-list"
className={classNames(
'absolute top-14 z-10 mr-4 mt-3 flex w-32 list-none flex-col items-center justify-center rounded-lg bg-white p-0 shadow-lightFlag dark:bg-black dark:shadow-darkFlag',
{ hidden: hiddenMenu }
"absolute top-14 z-10 mr-4 mt-3 flex w-32 list-none flex-col items-center justify-center rounded-lg bg-white p-0 shadow-lightFlag dark:bg-black dark:shadow-darkFlag",
{ hidden: hiddenMenu },
)}
>
{LOCALES.filter((locale) => {
@@ -82,7 +82,7 @@ export const Locales = (props: LocalesProps): JSX.Element => {
return (
<li
key={locale}
className='flex h-12 w-full items-center justify-center hover:bg-[#4f545c] hover:bg-opacity-20'
className="flex h-12 w-full items-center justify-center hover:bg-[#4f545c] hover:bg-opacity-20"
onClick={async () => {
return await handleLocale(locale)
}}