Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - When closing effect is disabled the modal state does not transition to Closed #10

Open
anotherhale opened this issue Jan 12, 2021 · 3 comments · May be fixed by #14
Open

Bug - When closing effect is disabled the modal state does not transition to Closed #10

anotherhale opened this issue Jan 12, 2021 · 3 comments · May be fixed by #14
Assignees

Comments

@anotherhale
Copy link
Collaborator

Bug - If Modal.setClosingEffect WithoutAnimate is configured the state remains in Closing status (does not transition to Closed)

@anotherhale anotherhale self-assigned this Jan 12, 2021
@anotherhale
Copy link
Collaborator Author

To transition to the closing status the current code requires the state to transition to AnimationEnd - but this does not happen if ClosingEffect is set to WithoutAnimate.
I have come up with a solution that actually removes Effects all together and instead added another animation state FromNone and ToNone

type OpeningAnimation
    = FromTop
    | FromRight
    | FromBottom
    | FromLeft
    | FromNone
type ClosingAnimation
    = ToTop
    | ToRight
    | ToBottom
    | ToLeft
    | ToNone

These animations just have the transition animation set to 0s so that they essentially have the WithoutAnimate Effect.

If this is acceptable I will open a PR.

As you can see I also updated the Example code and will have a PR for that soon too.

Elm.modal.mp4

@anotherhale
Copy link
Collaborator Author

Configuring this is as simple as specifying FromNone or ToNone in the setOpeningAnimation or setClosingAnimation:

              div []
                [ button
                    [ class "button btn--width"
                    , onClick
                        (AlertClicked (Modal.openModal
                            ModalMsg
                            (configAlert
                                |> Modal.setOpeningAnimation FromNone
                                |> Modal.setClosingAnimation ToBottom
                            )
                        ) )
                    ]
                    [ i [ class "fi-x icon--margin" ] []
                    , i [ class "fi-arrow-down icon--margin" ] []
                    ]
                ]

@ondrej-tucek
Copy link
Contributor

It's great, nice job Andy! I agree, open PR please.

As I'm now looking at to the README, there are missing any descriptions of OpeningAnimation, OpenedAnimation, ClosingAnimation and ClosingEffect types for users here. I mean, e.g. The OpeningAnimation type offers FromTop, FromRight, FromBottom, FromLeft and FromNone animations for modal window. All available animation types you can see (and of course use) below in the table...

I think it could be useful to have some kind of information for that. But it can be done at the end...

anotherhale added a commit to anotherhale/elm-modal that referenced this issue Jan 16, 2021
anotherhale added a commit to anotherhale/elm-modal that referenced this issue Jan 16, 2021
anotherhale added a commit to anotherhale/elm-modal that referenced this issue Jan 16, 2021
anotherhale added a commit to anotherhale/elm-modal that referenced this issue Jan 16, 2021
anotherhale added a commit to anotherhale/elm-modal that referenced this issue Jan 16, 2021
@anotherhale anotherhale linked a pull request Jan 16, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants