Skip to content

Commit 0a85d1f

Browse files
committed
Style improvements for home and articles index
1 parent 6776575 commit 0a85d1f

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

app/content/pages/index.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ title: Joy of Rails
99
<%= render Pages::Summary.from_page(page, side: side) %>
1010
<% end %>
1111

12-
<%= render Pages::List.new(articles.drop(3).take(6), class: "mt-16") %>
12+
<h3 class="mt-16">More articles</h3>
13+
<%= render Pages::List.new(articles.drop(3).take(6)) %>
1314
</div>
1415
</section>
1516
<section>

app/javascript/css/utilities/tailwind-media.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,8 @@
117117
.lg\:aspect-\[3\/2\] {
118118
aspect-ratio: 3 / 2;
119119
}
120+
121+
.lg\:block {
122+
display: block;
123+
}
120124
}

app/javascript/css/utilities/tailwind.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,14 @@ focus\:ring-0:focus {
10811081
aspect-ratio: 16 / 9;
10821082
}
10831083

1084+
.aspect-\[2\/1\] {
1085+
aspect-ratio: 2 / 1;
1086+
}
1087+
1088+
.object-cover {
1089+
object-fit: cover;
1090+
}
1091+
10841092
.drop-shadow-sm {
10851093
filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05));
10861094
}

app/views/components/pages/card.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def view_template
1616
figure(class: "page-card--image w-full") do
1717
image_tag @image,
1818
alt: description,
19-
class: "aspect-[16/9] w-full rounded-2xl object-cover sm:aspect-[2/1] lg:aspect-[3/2]"
19+
class: "w-full rounded-2xl object-cover aspect-[16/9]"
2020
end
2121
end
2222
div(class: "max-w-xl") do

app/views/components/pages/summary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def content(**)
5757
def image(**)
5858
div(**) do
5959
figure(class: "page-summary--image") do
60-
image_tag @image, class: "w-full"
60+
image_tag @image, class: "w-full object-cover aspect-[2/1] lg:aspect-[3/2]"
6161
end
6262
rescue
6363
ActionView::Template::Error

0 commit comments

Comments
 (0)