1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 15:14:23 +00:00
festa/components/events/actions/edit.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-07-19 18:25:11 +00:00
import { Event } from "@prisma/client"
import { useMemo } from "react"
import { KeyedMutator } from "swr"
import { ViewContent } from "../../generic/views/content"
export type EventsActionViewProps = {
data: Event,
mutate: KeyedMutator<Event>,
}
export const EventsActionEdit = ({ data, mutate }: EventsActionViewProps) => {
return (
<ViewContent
title={
useMemo(
() => (
<input
type="text"
value={data.name}
onChange={e => mutate({ ...data, name: e.target.value }, { revalidate: false })}
/>
),
[data.name]
)
}
content={<>
{useMemo(
() => (
<textarea
rows={12}
value={data.description}
onChange={e => mutate({ ...data, description: e.target.value }, { revalidate: false })}
/>
),
[data.description]
)}
</>}
/>
)
}