Add neighbour planting sidebar with improved styling and layout

This commit is contained in:
Brenda Wallace committed 2026-09-24 18:45:16 +12:00
1 parent 70ac8d8ab6
commit 8489fc0711
3 files changed
+68 -5

No files matched your search

+50 -2
View File
@@ -694,7 +694,55 @@
margin-left: 0.5rem;
}
.neighbours .index-cards .card {
width: 100%;
// Neighbours are a list, not a grid: in a narrow column a full planting card
// is one huge photo each. A small photo, who grows it and where is enough to
// decide whether to go and look.
.planting-neighbours-lead {
margin-bottom: 0.75rem;
}
.planting-neighbours {
display: flex;
flex-direction: column;
}
.planting-neighbour {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.5rem 0;
border-top: 1px solid rgba(65, 63, 59, 0.12);
color: inherit;
text-decoration: none;
&:first-child {
border-top: 0;
}
&:hover,
&:focus {
background: rgba(65, 63, 59, 0.04);
}
}
.planting-neighbour-photo {
flex: 0 0 auto;
width: 48px;
height: 48px;
border-radius: $card-radius;
object-fit: cover;
}
.planting-neighbour-text {
min-width: 0;
font-size: 0.9rem;
line-height: 1.3;
}
.planting-neighbour-where {
display: block;
color: rgba(65, 63, 59, 0.7);
font-size: 0.8rem;
overflow-wrap: anywhere;
}
}
+14
View File
@@ -0,0 +1,14 @@
-# One neighbouring planting, as a compact sidebar row. Not plantings/_card:
-# that is a card for a grid, and in a narrow column it is one huge photo per
-# neighbour, with the owner's quick-actions menu floating over it.
= link_to planting_path(neighbour), class: 'planting-neighbour' do
= image_tag neighbour.thumbnail_url || placeholder_image, alt: '', class: 'planting-neighbour-photo'
%span.planting-neighbour-text
%strong= neighbour.owner_login_name
%span.planting-neighbour-where
-# The crop is the same for every neighbour, so the useful facts are who
-# grows it and where.
= neighbour.garden_name
- if neighbour.location.present?
·
= neighbour.location
+4 -3
View File
@@ -112,7 +112,8 @@
%section.neighbours
.section-header
%h2= t('plantings.show.neighbours')
.index-cards
%p.text-muted.small.planting-neighbours-lead
= t('plantings.show.neighbours_explanation', crop: @planting.crop.name)
.planting-neighbours
- @neighbours.each do |neighbour|
= render 'plantings/card', planting: neighbour
%p.text-muted= t('plantings.show.neighbours_explanation', crop: @planting.crop.name)
= render 'plantings/neighbour', neighbour: neighbour