Giter Site home page Giter Site logo

Comments (2)

lepikhinb avatar lepikhinb commented on August 16, 2024

You shouldn't use a layout in the modal component. Layout can only be used for the root (parent) page.

Also, you should use the methods close, redirect, and the visibility variable show provided by the useModal() method, to manage the state of the modal.

Please check the official example implementation.

<script setup>
import { Dialog, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from "@headlessui/vue";
import { CheckIcon } from "@heroicons/vue/24/outline";
import { useModal } from "momentum-modal";

const { show, close, redirect } = useModal();
</script>

<template>
  <TransitionRoot :show="show" as="template">
    <Dialog as="div" class="relative z-10" @close="close">
      <TransitionChild
        @after-leave="redirect"
        as="template"
        enter="ease-out duration-300"
        enter-from="opacity-0"
        enter-to="opacity-100"
        leave="ease-in duration-200"
        leave-from="opacity-100"
        leave-to="opacity-0"
      >
        <div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
      </TransitionChild>
    </Dialog>
  </TransitionRoot>
</template>

Check the video with the changes applied: https://share.cleanshot.com/9H6b8k.

from momentum-modal.

haztakki avatar haztakki commented on August 16, 2024

Hey,
Thanks for looking into this. Yeah, the layout doesn't make sense in the modal component. Though the other side effects I mentioned was also throwing me a bit. I guess I just needed to use close and redirect methods like you said. I guess this is the missing piece. Thanks! I'll close this now, and I will reopen if needed.

from momentum-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.