Skip to content

Add new Modal component with comprehensive DaisyUI modal patterns support - #41

Draft
Nittarab with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-28-2
Draft

Add new Modal component with comprehensive DaisyUI modal patterns support#41
Nittarab with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-28-2

Conversation

Copilot AI commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

This PR implements a new Modal component for the DaisyComponents library, providing comprehensive support for all DaisyUI modal patterns and interactions.

Features

The Modal component supports three different modal implementation patterns:

Dialog Modal (HTML5 Dialog Element)

<%= render DaisyUI::Modal.new(
  modal_id: "my_modal_1",
  modal_type: :dialog,
  title: "Hello!",
  content: "Press ESC key or click the button below to close"
) %>

Checkbox Modal (Pure CSS Implementation)

<%= render DaisyUI::Modal.new(
  modal_id: "my_modal_6", 
  modal_type: :checkbox,
  title: "Hello!",
  content: "This modal works with a hidden checkbox!"
) %>

Anchor Modal (Navigation-based)

<%= render DaisyUI::Modal.new(
  modal_id: "my_modal_8",
  modal_type: :anchor,
  title: "Hello!",
  content: "This modal works with anchor links"
) %>

Modal Features

  • Backdrop Close: Click outside modal to close (backdrop_close: true)
  • Corner Close Button: Close button in top-right corner (corner_close: true)
  • Custom Sizing: Custom modal box width (modal_box_class: "w-11/12 max-w-5xl")
  • Responsive Behavior: Adaptive positioning (responsive: true)
  • Position Control: Top, middle, bottom positioning (position: :middle)

Implementation Details

The Modal component follows established DaisyComponents patterns:

  • Inherits from DaisyUI::BaseComponent
  • Uses build_argument() method for parameter validation
  • Implements namespace collapsing (file: actions/modal.rb → class: DaisyUI::Modal)
  • Comprehensive documentation with usage examples
  • Parameter validation with meaningful error messages

Testing & Preview Integration

  • Complete Lookbook preview integration with 8 example methods
  • Fixture-based testing using PreviewTestConcern
  • Playground preview with interactive parameter controls
  • All preview methods map to existing modal fixtures for consistency
  • Comprehensive test coverage including edge cases and validation

The component generates HTML that exactly matches the existing DaisyUI modal fixture patterns, ensuring compatibility with the established design system.

Fixes #28.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • mise.run
    • Triggering command: curl -fsSL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits August 6, 2025 12:49
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new Modal component Add new Modal component with comprehensive DaisyUI modal patterns support Aug 6, 2025
Copilot AI requested a review from Nittarab August 6, 2025 13:01
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.

Add new Modal component

2 participants