Embed widths are now the same width as all content

This commit is contained in:
Edward Loveall 2021-09-25 13:26:10 -04:00
parent 561483cf9f
commit bd56bfdd9f
No known key found for this signature in database
GPG key ID: 789A4AE983AC8901
3 changed files with 17 additions and 11 deletions

View file

@ -246,10 +246,10 @@ describe PageContent do
html = PageContent.new(page: page).render_to_string html = PageContent.new(page: page).render_to_string
html.should eq stripped_html <<-HTML html.should eq stripped_html <<-HTML
<div class="iframe-wrapper"> <figure>
<iframe src="https://example.com" width="800" height="480" frameborder="0" allowfullscreen="true"> <iframe src="https://example.com" width="800" height="480" frameborder="0" allowfullscreen="true">
</iframe> </iframe>
</div> </figure>
HTML HTML
end end
@ -270,9 +270,9 @@ describe PageContent do
html.should eq stripped_html <<-HTML html.should eq stripped_html <<-HTML
<p> <p>
<div class="embedded"> <figure>
<a href="https://example.com">Embedded content at example.com</a> <a href="https://example.com">Embedded content at example.com</a>
</div> </figure>
</p> </p>
HTML HTML
end end
@ -299,9 +299,11 @@ describe PageContent do
html.should eq stripped_html <<-HTML html.should eq stripped_html <<-HTML
<p> <p>
<div class="embedded"> <blockquote>
<a href="https://example.com">Mixtape</a> <p>
</div> <a href="https://example.com">Mixtape</a>
</p>
</blockquote>
</p> </p>
HTML HTML
end end

View file

@ -32,7 +32,7 @@ class PageContent < BaseComponent
end end
def render_child(child : EmbeddedContent) def render_child(child : EmbeddedContent)
div class: "iframe-wrapper" do figure do
iframe( iframe(
src: child.src, src: child.src,
width: child.width, width: child.width,
@ -44,7 +44,7 @@ class PageContent < BaseComponent
end end
def render_child(child : EmbeddedLink) def render_child(child : EmbeddedLink)
div class: "embedded" do figure do
a href: child.href do a href: child.href do
text "Embedded content at #{child.domain}" text "Embedded content at #{child.domain}"
end end
@ -98,8 +98,8 @@ class PageContent < BaseComponent
end end
def render_child(node : MixtapeEmbed) def render_child(node : MixtapeEmbed)
div class: "embedded" do blockquote do
render_children(node.children) para { render_children(node.children) }
end end
end end

View file

@ -6,3 +6,7 @@ p.meta {
font-size: 1.2rem; font-size: 1.2rem;
line-height: 1; line-height: 1;
} }
figure iframe {
max-width: 100%;
}