chore: better Prettier config for easier reviews

This commit is contained in:
2023-10-23 23:33:39 +02:00
parent a8781724d4
commit 71ea41695f
209 changed files with 4093 additions and 4114 deletions

View File

@ -1,11 +1,11 @@
import { useState } from 'react'
import Link from 'next/link'
import useTranslation from 'next-translate/useTranslation'
import classNames from 'clsx'
import { useState } from "react"
import Link from "next/link"
import useTranslation from "next-translate/useTranslation"
import classNames from "clsx"
import { FormState } from '../FormState'
import { FormState } from "../FormState"
export interface InputProps extends React.ComponentPropsWithRef<'input'> {
export interface InputProps extends React.ComponentPropsWithRef<"input"> {
label: string
error?: string | null
showForgotPassword?: boolean
@ -13,7 +13,7 @@ export interface InputProps extends React.ComponentPropsWithRef<'input'> {
}
export const getInputType = (inputType: string): string => {
return inputType === 'password' ? 'text' : 'password'
return inputType === "password" ? "text" : "password"
}
export const Input: React.FC<InputProps> = (props) => {
@ -21,7 +21,7 @@ export const Input: React.FC<InputProps> = (props) => {
label,
name,
className,
type = 'text',
type = "text",
showForgotPassword = false,
error,
...rest
@ -35,43 +35,43 @@ export const Input: React.FC<InputProps> = (props) => {
}
return (
<div className='flex flex-col'>
<div className={classNames('mb-2 mt-6 flex justify-between', className)}>
<label className='pl-1' htmlFor={name}>
<div className="flex flex-col">
<div className={classNames("mb-2 mt-6 flex justify-between", className)}>
<label className="pl-1" htmlFor={name}>
{label}
</label>
{type === 'password' && showForgotPassword ? (
{type === "password" && showForgotPassword ? (
<Link
href='/authentication/forgot-password'
className='text-center font-headline text-xs text-green-800 hover:underline dark:text-green-400 sm:text-sm'
data-cy='forgot-password-link'
href="/authentication/forgot-password"
className="text-center font-headline text-xs text-green-800 hover:underline dark:text-green-400 sm:text-sm"
data-cy="forgot-password-link"
>
{t('authentication:forgot-password')}
{t("authentication:forgot-password")}
</Link>
) : null}
</div>
<div className='relative mt-0'>
<div className="relative mt-0">
<input
data-cy={`input-${name ?? 'name'}`}
className='h-11 w-full rounded-lg border border-transparent bg-[#f1f1f1] px-3 font-paragraph leading-10 text-[#2a2a2a] caret-green-600 focus:border focus:shadow-green focus:outline-none'
data-cy={`input-${name ?? "name"}`}
className="h-11 w-full rounded-lg border border-transparent bg-[#f1f1f1] px-3 font-paragraph leading-10 text-[#2a2a2a] caret-green-600 focus:border focus:shadow-green focus:outline-none"
{...rest}
id={name}
name={name}
type={inputType}
/>
{type === 'password' && (
{type === "password" && (
<div
data-cy='password-eye'
data-cy="password-eye"
onClick={handlePassword}
style={{
backgroundImage: `url('/images/svg/icons/input/${inputType}.svg')`
backgroundImage: `url('/images/svg/icons/input/${inputType}.svg')`,
}}
className='absolute right-4 top-3 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover'
className="absolute right-4 top-3 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover"
/>
)}
<FormState
id={`error-${name ?? 'input'}`}
state={error == null ? 'idle' : 'error'}
id={`error-${name ?? "input"}`}
state={error == null ? "idle" : "error"}
message={error}
/>
</div>

View File

@ -1 +1 @@
export * from './Input'
export * from "./Input"