Narrow the profile editor modal and use a responsive banner ratio

This commit is contained in:
raucao committed 2026-11-27 16:07:32 +04:00
1 parent a0efd34a69
commit b419f9de09
2 files changed
+23 -4

No files matched your search

@@ -1,4 +1,4 @@
<div class="w-[72vw] md:w-[640px] lg:w-[760px]"
<div class="w-[72vw] md:w-[600px]"
data-controller="nostr-image-upload"
data-nostr-image-upload-store-url-value="<%= nostr_profile_images_settings_path %>"
data-nostr-image-upload-picture-max-bytes-value="<%= BlossomManagerService.max_upload_bytes("picture") %>"
@@ -18,11 +18,11 @@
:'nostr-profile-editor-flush-url-value' => nostr_media_settings_path
}
}) do |f| %>
<header class="absolute z-10 h-36 sm:h-44 inset-x-1 top-1 rounded-t
<header class="-mx-8 -mt-8 relative aspect-[11/4] sm:aspect-[7/2] rounded-t
bg-cover bg-center bg-gray-50"
style="<%= "background-image: url('#{banner_url}');" if banner_url %>"
data-nostr-profile-editor-target="bannerPreview">
<div class="inline-block z-20 size-28 sm:size-32 ml-4 mt-16 sm:mt-20">
<div class="absolute -bottom-14 left-4 z-20 size-28 sm:-bottom-16 sm:size-32">
<%= tag.img src: picture_url.presence,
class: "inline-block size-28 sm:size-32 rounded-full border-2 border-white #{'hidden' unless picture_url}",
data: { :'nostr-profile-editor-target' => "picturePreview" } %>
@@ -48,7 +48,7 @@
</div>
<% end %>
</header>
<main class="mt-44 sm:mt-52">
<main class="pt-20 sm:pt-24">
<div class="grid grid-cols-1 gap-y-6 md:grid-cols-2 md:gap-x-8">
<div>
<%= render FormElements::FieldsetComponent.new(tag: "div", title: "Display name") do %>
@@ -23,6 +23,25 @@ RSpec.describe Settings::NostrEditProfileComponent, type: :component do
expect(rendered.css("[data-nostr-profile-editor-target='submit']")).to be_present
end
it "uses the standard editor width and a responsive banner ratio" do
rendered = render_inline(described_class.new(user: user, profile_event: nil))
root = rendered.css("[data-controller='nostr-image-upload']").first
expect(root["class"]).to include("md:w-[600px]")
expect(root["class"]).not_to include("lg:w-[760px]")
header = rendered.css("header").first
expect(header["class"]).to include("aspect-[11/4]", "sm:aspect-[7/2]")
expect(header["class"]).not_to include("aspect-[3/1]", "h-36", "h-44")
avatar = header.css(".absolute").find { |node| node["class"].to_s.include?("size-28") }
expect(avatar["class"]).to include("-bottom-14", "left-4")
main = rendered.css("main").first
expect(main["class"]).to include("pt-20", "sm:pt-24")
expect(main["class"]).not_to include("mt-44")
end
it "passes the display-name key list to the editor" do
rendered = render_inline(described_class.new(user: user, profile_event: nil))