Skip to content

Commit

Permalink
Merge branch 'main' into feature/63_allow_image_tag_loading_to_be_wri…
Browse files Browse the repository at this point in the history
…tten
  • Loading branch information
jmarsh24 authored Jul 31, 2023
2 parents 9b11553 + 8dd518f commit bb1c893
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/rails_app/app/views/posts/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ h1 Posts

p data-controller="hello"

a href=modal_path(new_post_path) Write New Post
a href=modal_path(new_post_path, size: "custom-size") Write New Post

- @posts.each do |post|
= image_tag post.image, width: 200, loading: :lazy if post.image.attached?
Expand Down
1 change: 1 addition & 0 deletions spec/system/modal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

click_on "Write New Post"
expect(page).to have_selector ".modal--open"
expect(page).to have_selector ".modal--custom-size"
expect(page).to have_content "Compose Post"
expect(page).to have_link "Cancel"

Expand Down
6 changes: 5 additions & 1 deletion src/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ export class Modal {
closeButton.style.display = close ?? true ? "block" : "none";
root.classList.add("modal--open");
root.classList.add("modal--loading");
root.classList.toggle("modal--small", size === "small");

if (size) {
root.classList.add(`modal--${size}`);
}

frame.innerHTML = await getHTML(url);
root.classList.remove("modal--loading");
}
Expand Down

0 comments on commit bb1c893

Please sign in to comment.