prettier all the things

This commit is contained in:
Thomas Ruoff
2022-02-19 23:18:49 +01:00
committed by Thomas Ruoff
parent c35d3009c6
commit 36f8719531
28 changed files with 433 additions and 428 deletions

View File

@@ -19,34 +19,34 @@ export default function DateSelect() {
onChange={onChange}
className="my-6 max-w-lg"
/>
</InputWrapper>
<div className="flex flex-wrap -mx-3 mb-2">
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<Input
label="Von"
type="date"
className=""
name="startDate"
value={startDate || ''}
onChange={onChangeEvent}
min={today}
required
/>
</div>
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<Input
required
label="Bis"
type="date"
className=""
name="endDate"
value={endDate || ''}
placeholder="Von"
onChange={onChangeEvent}
min={startDate || today}
/>
</div>
</InputWrapper>
<div className="flex flex-wrap -mx-3 mb-2">
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<Input
label="Von"
type="date"
className=""
name="startDate"
value={startDate || ''}
onChange={onChangeEvent}
min={today}
required
/>
</div>
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<Input
required
label="Bis"
type="date"
className=""
name="endDate"
value={endDate || ''}
placeholder="Von"
onChange={onChangeEvent}
min={startDate || today}
/>
</div>
</div>
</>
)
}

View File

@@ -22,7 +22,10 @@ function BookForm() {
{dataStoredLoaded && (
<p className="mb-6 info-message">
Buchungsdaten wurden aus Deinem Browser geladen und vorausgefüllt.{' '}
<a className="font-medium text-blue-400 underline cursor-pointer hover:text-blue-600" onClick={forgetData}>
<a
className="font-medium text-blue-400 underline cursor-pointer hover:text-blue-600"
onClick={forgetData}
>
Daten wieder vergessen
</a>
</p>

View File

@@ -9,7 +9,10 @@ export default function Denied() {
onClick={(e) => {
e.preventDefault()
signIn()
}}>Melde dich an um diese Seite zu sehen.</a>
}}
>
Melde dich an um diese Seite zu sehen.
</a>
</p>
</>
)

View File

@@ -7,10 +7,18 @@ type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
}
export default function Input(props: InputProps) {
const { label, name, required, type = 'text', className = "", ...rest } = props
const {
label,
name,
required,
type = 'text',
className = '',
...rest
} = props
const defaultClasses = "appearance-none bg-gray-50 text-gray-500 border rounded py-2 px-3 mb-3 leading-tight disabled:bg-gray-200 disabled:cursor-not-allowed focus: outline-none focus:bg-white w-full"
const classes = `${defaultClasses} ${className}`;
const defaultClasses =
'appearance-none bg-gray-50 text-gray-500 border rounded py-2 px-3 mb-3 leading-tight disabled:bg-gray-200 disabled:cursor-not-allowed focus: outline-none focus:bg-white w-full'
const classes = `${defaultClasses} ${className}`
return (
<InputWrapper label={label} name={name} required={required}>

View File

@@ -13,7 +13,10 @@ export default function Input(props: {
<>
<div className="flex flex-wrap -mx-3 mb-2">
<div className="w-full px-3 mb-2">
<label className="block uppercase tracking-wide text-gray-500 text-xs font-bold mb-2" htmlFor={name}>
<label
className="block uppercase tracking-wide text-gray-500 text-xs font-bold mb-2"
htmlFor={name}
>
{label} {required && <Required />}
</label>
{children}

View File

@@ -1,32 +1,36 @@
const H1 = (props: any) => (
<h1
className="pb-2 mt-6 mb-4 text-4xl font-semibold leading-tight border-b"
{...props}
/>
)
<h1
className="pb-2 mt-6 mb-4 text-4xl font-semibold leading-tight border-b"
{...props}
/>
)
const H2 = (props: any) => (
<h2
className="pb-2 mt-6 mb-4 text-2xl font-semibold leading-tight border-b"
{...props}
/>
)
<h2
className="pb-2 mt-6 mb-4 text-2xl font-semibold leading-tight border-b"
{...props}
/>
)
const H3 = (props: any) => (
<h3 className="mt-6 mb-4 text-lg font-semibold leading-snug" {...props} />
)
<h3 className="mt-6 mb-4 text-lg font-semibold leading-snug" {...props} />
)
const H4 = (props: any) => (
<h4 className="mt-6 mb-4 text-base font-semibold leading-none" {...props} />
)
<h4 className="mt-6 mb-4 text-base font-semibold leading-none" {...props} />
)
const H5 = (props: any) => (
<h5 className="mt-6 mb-4 text-sm font-semibold leading-tight" {...props} />
)
<h5 className="mt-6 mb-4 text-sm font-semibold leading-tight" {...props} />
)
const H6 = (props: any) => (
<h6
className="mt-6 mb-4 text-sm font-semibold leading-tight text-gray-600"
{...props}
/>
)
const UL = (props: any) => <ul className="pl-8 text-base list-disc" {...props} />
const OL = (props: any) => <ol className="pl-8 text-base list-decimal" {...props} />
<h6
className="mt-6 mb-4 text-sm font-semibold leading-tight text-gray-600"
{...props}
/>
)
const UL = (props: any) => (
<ul className="pl-8 text-base list-disc" {...props} />
)
const OL = (props: any) => (
<ol className="pl-8 text-base list-decimal" {...props} />
)
const MdComponents = {
h1: H1,
@@ -39,4 +43,4 @@ const MdComponents = {
ol: OL,
}
export default MdComponents;
export default MdComponents

View File

@@ -5,7 +5,6 @@ import { useSession } from 'next-auth/react'
import User from './user'
const pathNameLabelMap = {
'/login': 'Login',
'/admin': 'Buchungsübersicht',
@@ -21,7 +20,7 @@ function getPathNameMap(route: string) {
}
export default function Navigation() {
const { data, status } = useSession();
const { data, status } = useSession()
const router = useRouter()
const pathname = router.pathname

View File

@@ -1,11 +1,10 @@
import { useSession, signOut } from 'next-auth/react'
export default function User() {
const { data, status } = useSession();
const { data, status } = useSession()
if (status === 'loading' || !data?.user?.email) {
return null;
return null
}
return (