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

Implement Restricted Close Mode for UpWindowAngularComponent #6

Merged
merged 5 commits into from
Oct 14, 2024

Conversation

lucasferreiralimax
Copy link
Member

@lucasferreiralimax lucasferreiralimax commented Oct 14, 2024

This pull request introduces a "restricted mode" to the UpWindowAngularComponent. In this mode, the modal can only be closed using the "Cancel" or "Confirm" buttons. The close button (×) is hidden, and clicking on the overlay does not close the modal.

Changes Made:

  1. Added restrictMode Input:

    • Introduced a new input property restrictMode: boolean to control the behavior of the modal.
    • Default value is false to maintain existing functionality.
  2. Updated Template:

    • Conditionally rendered the close button based on the restrictMode value.
    • Modified the click event on the overlay to prevent closing the modal when restrictMode is true.
  3. Behavior:

    • When restrictMode is false:
      • The close button is visible, and the modal can be closed by clicking it or the overlay.
    • When restrictMode is true:
      • The close button is hidden, and the modal can only be closed by the "Cancel" or "Confirm" buttons.
    • A shake animation is triggered if the user attempts to close the modal using the ESC key or by clicking on the overlay in restricted mode.

Example Usage:

<up-window-angular
  [isOpen]="isModalOpen"
  [restrictMode]="true"  <!-- Activates restricted mode -->
  title="Modal Title"
  subtitle="Modal Subtitle"
  (confirm)="onConfirm()"
  (cancel)="onCancel()"
>
  Modal Content
</up-window-angular>

Testing:

  • Verified that the modal behaves as expected in both restricted and unrestricted modes.
  • Ensured that all existing functionality remains intact.
  • Confirmed that the shake animation is triggered appropriately when attempting to exit the modal in restricted mode.

@lucasferreiralimax lucasferreiralimax self-assigned this Oct 14, 2024
@lucasferreiralimax lucasferreiralimax linked an issue Oct 14, 2024 that may be closed by this pull request
@lucasferreiralimax
Copy link
Member Author

Screenshot 2024-10-14 171015

Copy link

github-actions bot commented Oct 14, 2024

Visit the preview URL for this PR (updated for commit ab5767e):

https://up-window-angular--pr6-mode-restricted-6x9alc4m.web.app

(expires Mon, 21 Oct 2024 21:24:26 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 7822e0d6e40bbbcb5ceaa0eda2c38488d7b613f8

@lucasferreiralimax
Copy link
Member Author

Animation shake

modo-restrict-window.mp4

@lucasferreiralimax lucasferreiralimax merged commit ac857fb into master Oct 14, 2024
2 checks passed
@lucasferreiralimax lucasferreiralimax deleted the mode-restricted branch October 14, 2024 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Restricted Close Mode for UpWindowAngularComponent
1 participant