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

feat: modal component #267

Merged
merged 3 commits into from
Feb 7, 2025
Merged

feat: modal component #267

merged 3 commits into from
Feb 7, 2025

Conversation

ell-ska
Copy link
Contributor

@ell-ska ell-ska commented Feb 4, 2025

closes #63

  • create base modal
  • create overlay that closes the modal on click
  • create events to open and close the modal
  • create two variants of the modal
    • one for the menu variant
    • one for the input variant
    • and you can also choose to just use the base modal (will be needed for add to list/add to movie modals because they look very different)
  • keyboard accessible
    • focus trap
    • close on esc

preview

Skarminspelning.2025-02-04.kl.15.43.09.mov

example usage with form

<x-button x-data @click="$dispatch('open-modal', 'example-modal')">
    Open modal
</x-button>

<x-modal.base name="example-modal">
    <x-modal.input>
        <x-slot:title>Example modal</x-slot>
        <form>
          {{-- add your inputs here --}}

          <x-button
              x-data
              @click="$dispatch('close-modal', 'example-modal')"
              type="button"
          >
              Close modal
          </x-button>
        </form>
    </x-modal.input>
</x-modal.base>

example usage with menu items

<x-button x-data @click="$dispatch('open-modal', 'example-modal')">
    Open modal
</x-button>

<x-modal.base name="example-modal">
    <x-modal.menu>
        <x-slot:title>Example modal</x-slot>
          {{-- add your menu items here --}}
    </x-modal.menu>
</x-modal.base>

note:
this is heavily inspired by this modal from the boilerplate breeze code we removed. so i hope the laravel team is setting a good example :)

Copy link
Contributor

@beforeAW beforeAW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ADchasacademy ADchasacademy self-requested a review February 6, 2025 15:49
@ell-ska ell-ska force-pushed the feat-modal-component branch from 9967f4f to ca961f0 Compare February 7, 2025 13:13
@ell-ska ell-ska temporarily deployed to feat-modal-component - u04-imdb-clone PR #267 February 7, 2025 13:13 — with Render Destroyed
@ell-ska ell-ska merged commit 7eff6b5 into main Feb 7, 2025
1 check passed
@ell-ska ell-ska deleted the feat-modal-component branch February 7, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create modal component
3 participants