-
Notifications
You must be signed in to change notification settings - Fork 20
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
Landing page images from content item #4375
Changes from all commits
ca0fc49
579c191
c80041d
a322ce6
83e008f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "ostruct" | ||
|
||
module LandingPage::Block::Concerns | ||
module HasImageSet | ||
FeaturedImage = Data.define(:alt, :sources) | ||
|
||
def image | ||
@image ||= load_image | ||
end | ||
|
||
def load_image | ||
FeaturedImage.new(alt: data["image"]["alt"], sources: OpenStruct.new(data["image"]["sources"])) | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ | |
|
||
<%= content_tag("div", class: hero_classes) do %> | ||
<%= picture_tag(class: "app-b-hero__imagewrapper") do %> | ||
<%= tag.source srcset: "#{image_path(block.image.sources.desktop)}, #{image_path(block.image.sources.desktop_2x)} 2x", media: "(min-width: 769px)" %> | ||
<%= tag.source srcset: "#{image_path(block.image.sources.tablet)}, #{image_path(block.image.sources.tablet_2x)} 2x", media: "(min-width: 641px) and (max-width: 768px)" %> | ||
<%= tag.source srcset: "#{image_path(block.image.sources.mobile)}, #{image_path(block.image.sources.mobile_2x)} 2x", media: "(max-width: 640px)" %> | ||
<%= image_tag(block.image.sources.desktop, alt: block.image.alt, class: "app-b-hero__image") %> | ||
<%= tag.source srcset: "#{block_image_path(block.image.sources.hero_desktop_1x)}, #{block_image_path(block.image.sources.hero_desktop_2x)} 2x", media: "(min-width: 769px)" %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently my branch drops the I don't mind either way really - I'd be happy to update my branch to put back the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 actually maybe I can get it to match whats currently there exactly, and we can lose this PR 🤔 |
||
<%= tag.source srcset: "#{block_image_path(block.image.sources.hero_tablet_1x)}, #{block_image_path(block.image.sources.hero_tablet_2x)} 2x", media: "(min-width: 641px) and (max-width: 768px)" %> | ||
<%= tag.source srcset: "#{block_image_path(block.image.sources.hero_mobile_1x)}, #{block_image_path(block.image.sources.hero_mobile_2x)} 2x", media: "(max-width: 640px)" %> | ||
<%= image_tag(block.image.sources.hero_desktop_1x, alt: block.image.alt, class: "app-b-hero__image") %> | ||
<% end %> | ||
|
||
<div class="govuk-width-container app-b-hero__textbox-wrapper"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,14 +35,14 @@ blocks: | |
navigation_group_id: Top Menu | ||
- type: hero | ||
image: | ||
alt: "Placeholder alt text" | ||
alt_text: "Placeholder alt text" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't mean to change this from |
||
sources: | ||
desktop: "landing_page/placeholder/desktop.png" | ||
desktop_2x: "landing_page/placeholder/desktop_2x.png" | ||
mobile: "landing_page/placeholder/mobile.png" | ||
mobile_2x: "landing_page/placeholder/mobile_2x.png" | ||
tablet: "landing_page/placeholder/tablet.png" | ||
tablet_2x: "landing_page/placeholder/tablet_2x.png" | ||
hero_desktop_1x: landing_page/placeholder/desktop.png | ||
hero_desktop_2x: landing_page/placeholder/desktop_2x.png | ||
hero_tablet_1x: landing_page/placeholder/tablet.png | ||
hero_tablet_2x: landing_page/placeholder/tablet_2x.png | ||
hero_mobile_1x: landing_page/placeholder/mobile.png | ||
hero_mobile_2x: landing_page/placeholder/mobile_2x.png | ||
hero_content: | ||
blocks: | ||
- type: heading | ||
|
@@ -91,14 +91,14 @@ blocks: | |
- type: hero | ||
theme: middle_left | ||
image: | ||
alt: "Placeholder alt text" | ||
alt_text: "Placeholder alt text" | ||
sources: | ||
desktop: "landing_page/placeholder/desktop.png" | ||
desktop_2x: "landing_page/placeholder/desktop_2x.png" | ||
mobile: "landing_page/placeholder/mobile.png" | ||
mobile_2x: "landing_page/placeholder/mobile_2x.png" | ||
tablet: "landing_page/placeholder/tablet.png" | ||
tablet_2x: "landing_page/placeholder/tablet_2x.png" | ||
hero_desktop_1x: landing_page/placeholder/desktop.png | ||
hero_desktop_2x: landing_page/placeholder/desktop_2x.png | ||
hero_tablet_1x: landing_page/placeholder/tablet.png | ||
hero_tablet_2x: landing_page/placeholder/tablet_2x.png | ||
hero_mobile_1x: landing_page/placeholder/mobile.png | ||
hero_mobile_2x: landing_page/placeholder/mobile_2x.png | ||
hero_content: | ||
blocks: | ||
- type: quote | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.