feat(Upload): readd opening upload jumper via custom event

This commit is contained in:
Aminejv 2021-10-27 17:32:31 +01:00
parent 108d2293a5
commit c041514bce
2 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,8 @@ export const Provider = ({ children, page, data, viewer }) => {
viewer,
});
useEventListener({ type: "open-upload-jumper", handler: showUploadJumper });
const providerValue = React.useMemo(
() => [
{ ...uploadState, isUploadJumperVisible },

View File

@ -32,13 +32,12 @@ const Root = ({ children, data }) => {
* -----------------------------------------------------------------------------------------------*/
const Trigger = ({ viewer, css, children, ...props }) => {
const [, { showUploadJumper }] = useUploadContext();
const showUploadModal = () => {
if (!viewer) {
Events.dispatchCustomEvent({ name: "slate-global-open-cta", detail: {} });
return;
}
showUploadJumper();
Events.dispatchCustomEvent({ name: "open-upload-jumper" });
};
return (