improve renaming user experience
This commit is contained in:
parent
bf202b958c
commit
e819ce242e
1 changed files with 34 additions and 27 deletions
|
|
@ -172,36 +172,43 @@ export default function VideoMoreMenu({ video }: Props) {
|
|||
leaveTo="opacity-0 scale-95"
|
||||
>
|
||||
<Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
|
||||
<div className="sm:col-span-4">
|
||||
<label
|
||||
htmlFor="title"
|
||||
className="block text-sm font-medium leading-6 text-gray-900"
|
||||
>
|
||||
Video title
|
||||
</label>
|
||||
<div className="mt-2">
|
||||
<input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.currentTarget.value)}
|
||||
id="title"
|
||||
name="title"
|
||||
type="title"
|
||||
autoComplete="title"
|
||||
className="block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
onClick={() => {
|
||||
renameVideoMutation.mutate({ videoId: video.id, title });
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
renameVideoMutation.mutate({
|
||||
videoId: video.id,
|
||||
title,
|
||||
});
|
||||
setRenameMenuOpen(false);
|
||||
}}
|
||||
className="mt-2 rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<div className="sm:col-span-4">
|
||||
<label
|
||||
htmlFor="title"
|
||||
className="block text-sm font-medium leading-6 text-gray-900"
|
||||
>
|
||||
Video title
|
||||
</label>
|
||||
<div className="mt-2">
|
||||
<input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.currentTarget.value)}
|
||||
id="title"
|
||||
name="title"
|
||||
type="title"
|
||||
autoComplete="title"
|
||||
className="block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="mt-2 rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
</form>
|
||||
</Dialog.Panel>
|
||||
</Transition.Child>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue