Skip to content

Commit

Permalink
Add card design to guide pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ddippolito committed Jul 11, 2024
1 parent 4338974 commit 4fad715
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $govuk-assets-path: "/";
@import 'leaflet-gesture-handling/dist/leaflet-gesture-handling';

@import 'base/global';
@import 'base/guide_card';
@import 'base/govuk/components/accordion';
@import 'base/govuk/components/error-summary';
@import 'base/govuk/components/inset-text';
Expand Down
39 changes: 39 additions & 0 deletions app/assets/stylesheets/base/_guide_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.hf-card-container {
background-color: #f3f2f1;
border-bottom: 3px solid #1d70b8;
margin-bottom: 30px;

.hf-card-image {
max-width:100%;
height: 200px;
object-fit: cover;
}
}

.hf-card-details {
padding: 30px;
min-height: 190px;
}

.hf-card a {
text-decoration: none;
}

.hf-card a .hf-card-details p {
color: #0b0c0c;
}

.hf-card a .hf-card-details h3 {
color: #1d70b8;
}

.hf-card a:hover .hf-card-container, .hf-card a:focus .hf-card-container {
background-color: #1d70b8;
}

.hf-card a:hover .hf-card-container .hf-card-details p,
.hf-card a:hover .hf-card-container .hf-card-details h3,
.hf-card a:focus .hf-card-container .hf-card-details p,
.hf-card a:focus .hf-card-container .hf-card-details h3 {
color: #ffffff;
}
4 changes: 4 additions & 0 deletions app/services/markdown_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def meta_description
@front_matter["meta_description"]
end

def card_image
@front_matter["card-image"]
end

def content
@kramdown_document.to_html
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.govuk-grid-column-two-thirds
h1 = @post.title

== sanitize @post.content
== @post.content

- if @post.date_posted
span.govuk-body-s
Expand Down
14 changes: 8 additions & 6 deletions app/views/posts/subcategory.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
formatted_subcategory => "" }

.govuk-grid-row
.govuk-grid-column-full
h1.govuk-heading-xl = formatted_subcategory.to_s
p.govuk-body = t(".#{params[:section]}.#{params[:subcategory]}")
ul.govuk-list
- @posts.sort.each do |post|
li = govuk_link_to(post.title, post_path(section: post.section, subcategory: post.subcategory, post_name: post.post_name))
- @posts.sort.each do |post|
.govuk-grid-column-one-third
.hf-card
.hf-card-container
img src=image_path(post.card_image) alt=post.title class="hf-card-image"
.hf-card-details
.govuk-heading-m = govuk_link_to(post.title, post_path(section: post.section, subcategory: post.subcategory, post_name: post.post_name))

0 comments on commit 4fad715

Please sign in to comment.