Skip to content

Commit 5dc12ff

Browse files
committed
Space and grid fixes for mobile web
1 parent 79740b0 commit 5dc12ff

File tree

9 files changed

+37
-20
lines changed

9 files changed

+37
-20
lines changed

app/content/pages/articles/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<section>
2-
<div class="main-content container py-3xl">
2+
<div class="main-content container py-gap lg:py-3xl">
33
<% ArticlePage.published.take(20).zip(%w[left right]).each do |(page, side)| %>
44
<%= render Pages::Summary.from_page(page, side: side) %>
55
<% end %>

app/content/pages/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Joy of Rails
33
---
44

55
<section style="min-height: 51vh">
6-
<div class="main-content container py-3xl">
6+
<div class="main-content container py-gap lg:py-3xl">
77
<% ArticlePage.published.take(3).zip(%w[left right]).each do |(page, side)| %>
88
<%= render Pages::Summary.from_page(page, side: side) %>
99
<% end %>

app/javascript/css/components/footer-content.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ footer {
33
}
44

55
.footer-content {
6-
padding-top: var(--space-3xl);
7-
padding-bottom: var(--space-3xl);
8-
96
& nav > * {
107
display: flex;
118
padding-top: var(--space-2xs-xs);

app/javascript/css/components/newsletter-banner.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ section:has(.newsletter-banner) {
33
}
44

55
.newsletter-banner {
6-
padding-top: var(--space-3xl);
7-
padding-bottom: var(--space-3xl);
8-
96
& h3 {
107
align-self: start;
118

app/javascript/css/layout.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ main > *,
4949
}
5050

5151
.main-content,
52-
.article-content,
53-
.section-content {
52+
.article-content {
5453
grid-gap: var(--grid-gutter);
5554
grid-template-columns: repeat(var(--grid-columns), [col-start] 1fr);
5655
grid-template-rows: minmax(calc(var(--leading) * 1em), max-content);
@@ -88,6 +87,10 @@ main > *,
8887
grid-template-columns: 1fr 2fr;
8988
}
9089

90+
.lg\:grid-cols-2 {
91+
grid-template-columns: repeat(2, minmax(0, 1fr));
92+
}
93+
9194
.article-content > .outside,
9295
.article-content > img {
9396
grid-column: col-start 9 / span 4;

app/javascript/css/utilities.css

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import 'config/variables.scss';
2+
13
.sr-only {
24
position: absolute;
35
width: 1px;
@@ -969,9 +971,27 @@ focus\:ring-0:focus {
969971
.text-right {
970972
text-align: right;
971973
}
974+
972975
/* Custom utilities */
973976

974-
.py-3xl {
975-
padding-top: var(--space-3xl);
976-
padding-bottom: var(--space-3xl);
977+
.py-gap {
978+
padding-top: var(--grid-gutter);
979+
padding-bottom: var(--grid-gutter);
980+
}
981+
982+
@media screen and (min-width: $screen-md) {
983+
}
984+
985+
@media screen and (min-width: $screen-lg) {
986+
lg\:text-left {
987+
text-align: left;
988+
}
989+
lg\:text-right {
990+
text-align: right;
991+
}
992+
993+
lg\.py-3xl {
994+
padding-top: var(--space-3xl);
995+
padding-bottom: var(--space-3xl);
996+
}
977997
}

app/views/application/_footer.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%= tag.footer class: "" do %>
2-
<div class="footer-content">
2+
<div class="footer-content py-gap lg:py-3xl">
33
<%= link_to root_path, class: "logo" do %>
44
<div class="">
55
<%= inline_svg_tag "joy-logo.svg", class: "fill-current" %>

app/views/components/pages/summary.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def initialize(title: nil, description: nil, published_on: nil, image: nil, requ
2424
end
2525

2626
def view_template
27-
div(class: "page-summary grid grid-cols-2") do
27+
div(class: "page-summary grid lg:grid-cols-2") do
2828
case @side
2929
when "left"
30-
content(class: "grid grid-row-tight text-right")
31-
image(class: "grid grid-row-tight text-left")
30+
content(class: "grid grid-row-tight lg:text-right")
31+
image(class: "grid grid-row-tight lg:text-left")
3232
else
33-
image(class: "grid grid-row-tight text-right")
34-
content(class: "grid grid-row-tight text-left")
33+
image(class: "grid grid-row-tight lg:text-right")
34+
content(class: "grid grid-row-tight lg:text-left")
3535
end
3636
end
3737
end

app/views/newsletter/_banner.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="newsletter-banner section-content container lg:grid-cols-1/2">
1+
<div class="newsletter-banner section-content container py-gap lg:py-3xl lg:grid-cols-1/2">
22
<h3 class="font-semibold">The Joy of Rails Newsletter:
33
<span>A spark of joy for your inbox</span>
44
</h3>

0 commit comments

Comments
 (0)