mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 12:39:49 +01:00
fix: close dialog on close
This commit is contained in:
1 parent
3293afba76
commit
a5aad61cb7
1 file changed
+4
-3
@@ -18,7 +18,6 @@ import { debounce } from 'lodash-es';
|
|||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { stringify } from 'urlon';
|
import { stringify } from 'urlon';
|
||||||
import type { configurations } from '../../constants/embeds';
|
import type { configurations } from '../../constants/embeds';
|
||||||
import { App } from '../../stores/app';
|
|
||||||
import { EmbedState, type EmbedStateStore } from '../../stores/embedState';
|
import { EmbedState, type EmbedStateStore } from '../../stores/embedState';
|
||||||
import { CopyButton } from '../CopyButton';
|
import { CopyButton } from '../CopyButton';
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ interface CopyURLProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function CopyURL({ embed }: CopyURLProps) {
|
export function CopyURL({ embed }: CopyURLProps) {
|
||||||
const appStore = App.useStore();
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
const embedStateStore = EmbedState.useStore();
|
const embedStateStore = EmbedState.useStore();
|
||||||
const input = useRef<HTMLInputElement>(null);
|
const input = useRef<HTMLInputElement>(null);
|
||||||
const [searching, setSearching] = useState(false);
|
const [searching, setSearching] = useState(false);
|
||||||
@@ -65,7 +64,7 @@ export function CopyURL({ embed }: CopyURLProps) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Root>
|
<Dialog.Root open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||||
<Dialog.Trigger>
|
<Dialog.Trigger>
|
||||||
<Button>
|
<Button>
|
||||||
<Link2Icon />
|
<Link2Icon />
|
||||||
@@ -132,6 +131,8 @@ export function CopyURL({ embed }: CopyURLProps) {
|
|||||||
state: stringify(shallowState),
|
state: stringify(shallowState),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setDialogOpen(false);
|
||||||
|
|
||||||
return `${location.origin}/tools/embed/${embed}/host?${searchParams.toString()}`;
|
return `${location.origin}/tools/embed/${embed}/host?${searchParams.toString()}`;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in new issue
Block a user