Files
growstuff/app/assets/stylesheets/_seeds.scss
T

916 lines
18 KiB
SCSS

// A seed card is drawn as a seed packet: tall and papery, with a torn top edge,
// a printed frame, a bold crop-name band and the small print along the bottom.
// Its proportions and its paper are what mark it out; the corner radius is the
// same as every other data card's.
.seed-card.card {
aspect-ratio: 3 / 4;
display: flex;
flex-direction: column;
border: 1px solid darken($beige, 25%);
background: $beige;
padding: 0.5rem;
position: relative;
overflow: hidden;
// The tear-off strip across the top of a real packet.
.seed-card-tear {
height: 0.6rem;
margin: -0.5rem -0.5rem 0.4rem;
background-image: linear-gradient(135deg, $beige 25%, transparent 25%),
linear-gradient(225deg, $beige 25%, transparent 25%);
background-size: 0.7rem 0.7rem;
background-position: 0 0;
background-color: darken($beige, 12%);
border-bottom: 1px dashed darken($beige, 30%);
}
// The illustration window, inset from the printed frame rather than bleeding
// to the card's edge.
.seed-card-window {
border: 1px solid $yellow;
overflow: hidden;
flex: 0 0 auto;
position: relative;
.img-card {
height: 110px;
display: block;
}
}
// The year the seeds were saved, stamped on the packet the way a home-saved
// one is written on by hand.
.seed-card-year {
position: absolute;
right: 0.3rem;
bottom: 0.3rem;
padding: 0.1rem 0.3rem;
border: 1px solid $brown;
border-radius: 2px;
background: rgba(244, 242, 239, 0.9);
color: $brown;
font-size: 0.7rem;
letter-spacing: 0.06em;
text-transform: uppercase;
transform: rotate(-4deg);
}
// The printed name band. Bolder and more letter-spaced than UI type, the way
// packet printing is.
.seed-card-band {
margin: 0.4rem 0 0.3rem;
text-align: center;
.card-title {
margin: 0;
padding: 0.15rem 0.25rem;
background-color: $green;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
font-size: 1rem;
a {
color: $white;
}
a:hover {
color: $black;
background-color: transparent;
}
}
h5 {
margin: 0.2rem 0 0;
font-size: 0.8rem;
color: $brown;
}
}
// The small print, as a packet carries it: one run of short facts, always
// rendered so every packet has the same shape.
.seed-card-print {
margin: auto 0 0;
padding: 0.3rem 0 0;
list-style: none;
border-top: 1px solid darken($beige, 20%);
font-size: 0.75rem;
letter-spacing: 0.02em;
text-transform: uppercase;
color: $brown;
text-align: center;
li {
display: inline;
&::after {
content: " · ";
}
&:last-child::after {
content: "";
}
}
}
}
// ---------------------------------------------------------------------------
// The seed library page: shelves of small seed packets.
// Paper, as a packet is printed on it, and the green wash behind what is open.
$seed-paper-edge: darken($beige, 25%);
$seed-paper-shade: darken($beige, 8%);
$seed-paper-fold: darken($beige, 14%);
$seed-wash: lighten($green, 55%);
$seed-rule: rgba($brown, 0.15);
// Something to pick: outlined, and filled green when it is the one in force.
@mixin seed-choice($ink: $green) {
padding: 0.35rem 0.85rem;
border: 1px solid $ink;
background: $white;
color: $ink;
font-size: 0.88rem;
line-height: 1.4;
text-decoration: none;
white-space: nowrap;
&.active {
border-color: $green;
background: $green;
color: $white;
}
}
// A page title in the light weight the design uses.
@mixin seed-title {
margin: 0;
font-size: 2.2rem;
font-weight: 300;
line-height: 1.1;
}
// The top of the page: whose library it is, which crop's seeds these are, or
// what the page is for, with the numbers or the ways to add at the right.
.seed-head {
display: flex;
flex-wrap: wrap;
gap: 1rem 1.25rem;
align-items: center;
margin: 0 0 1.25rem;
padding-top: 1.5rem;
.seed-head-image {
border-radius: 50%;
object-fit: cover;
}
.seed-head-about {
flex: 1 1 300px;
h1 {
@include seed-title;
}
h1 a {
color: inherit;
}
}
.seed-head-sub {
color: rgba($brown, 0.75);
}
.seed-head-stats {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
margin: 0;
padding: 0;
list-style: none;
li {
color: $brown;
font-size: 0.9rem;
}
b {
display: block;
color: $green;
font-size: 1.5rem;
font-weight: 600;
line-height: 1.1;
}
}
.seed-head-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
}
// Whose seeds: one rounded control with the chosen one filled green.
.seed-scope-row {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
align-items: center;
justify-content: space-between;
margin-bottom: 0.9rem;
}
.seed-scope {
display: inline-flex;
max-width: 100%;
overflow: hidden;
border: 1px solid $green;
border-radius: 999px;
a {
@include seed-choice;
padding: 0.4rem 1rem;
border-width: 0 0 0 1px;
&:first-child {
border-left-width: 0;
}
}
}
// Search, Group by and Cards/List on one line.
.seed-toolbar {
display: flex;
flex-wrap: wrap;
gap: 0.75rem 1rem;
align-items: center;
margin: 1rem 0 0.5rem;
.seed-search {
flex: 1 1 240px;
max-width: 320px;
}
// The crop chosen to look for, with a way to clear it.
.seed-crop {
display: inline-flex;
gap: 0.5rem;
align-items: center;
padding: 0.35rem 0.5rem 0.35rem 0.85rem;
border: 1px solid $green;
border-radius: 999px;
background: $seed-wash;
font-size: 0.88rem;
font-weight: 600;
}
.seed-crop-clear {
padding: 0 0.4rem;
color: $brown;
font-size: 1.1rem;
line-height: 1;
text-decoration: none;
}
.seed-group-by {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
align-items: center;
}
.seed-toolbar-label {
margin-right: 0.25rem;
color: rgba($brown, 0.75);
font-size: 0.88rem;
}
.seed-seg {
margin-left: auto;
}
}
// Round filter buttons. Named for the seeds page: the site-wide .chip is a
// fixed-height tag and would clip these.
.seed-chips {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0 0 1.1rem;
padding: 0;
list-style: none;
}
.seed-chip {
@include seed-choice($brown);
border-radius: 999px;
&:hover {
border-color: $green;
color: $green;
}
}
// Two choices joined into one control.
.seed-seg {
display: inline-flex;
a {
@include seed-choice;
margin-left: -1px;
&:first-child {
margin-left: 0;
border-radius: 2px 0 0 2px;
}
&:last-child {
border-radius: 0 2px 2px 0;
}
}
}
// Something to tell the member, in the orange of a warning or the green of a
// shelf.
.seed-tip,
.seed-search-summary {
margin-bottom: 1.4rem;
padding: 0.75rem 1rem;
border: 1px solid rgba($orange, 0.5);
border-radius: 4px;
background: rgba($orange, 0.12);
font-size: 0.9rem;
line-height: 1.45;
}
.seed-tip {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
align-items: center;
justify-content: space-between;
a {
font-weight: 700;
}
}
.seed-search-summary {
margin-bottom: 1rem;
border-color: rgba($green, 0.5);
background: rgba($green, 0.1);
}
.seed-none {
padding: 2rem 0.5rem;
text-align: center;
.seed-none-actions .btn {
margin: 0 0.25rem;
}
}
// The results while the next ones are on their way.
.seed-results {
transition: opacity 0.15s ease;
&.is-loading {
opacity: 0.5;
pointer-events: none;
}
}
@media (prefers-reduced-motion: reduce) {
.seed-results {
transition: none;
}
}
// A shelf is one group of seeds: a green bar naming it, over a white board the
// packets stand on. A shelf folded up is only its bar.
.seed-shelf {
margin-bottom: 1.4rem;
> summary {
list-style: none;
&::-webkit-details-marker {
display: none;
}
}
.seed-shelf-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0.9rem;
border-radius: 4px 4px 0 0;
background: $green;
cursor: pointer;
h3 {
margin: 0;
font-size: 1.25rem;
font-weight: 400;
}
a,
small,
span {
color: $white;
}
small {
margin-left: 0.6rem;
font-size: 0.9rem;
opacity: 0.9;
}
a,
.seed-shelf-closed-only {
font-size: 0.9rem;
font-weight: 600;
}
}
&:not([open]) {
margin-bottom: 0.2rem;
.seed-shelf-open-only {
display: none;
}
}
&[open] .seed-shelf-closed-only {
display: none;
}
.seed-shelf-packets {
display: flex;
flex-wrap: wrap;
gap: 1.25rem 1.1rem;
align-items: flex-start;
padding: 1.25rem 1rem 1rem;
border: 1px solid $seed-rule;
border-top: 0;
border-radius: 0 0 4px 4px;
background: $white;
box-shadow: 0 3px 3px -1px $seed-paper-shade;
}
}
// A seed packet, small: torn top, a picture, a green name band, small print.
.seed-packet {
position: relative;
display: flex;
flex-direction: column;
width: 150px;
min-height: 200px;
padding: 0.5rem;
overflow: hidden;
border: 1px solid $seed-paper-edge;
border-radius: 4px;
background: $beige;
box-shadow: 1px 3px 3px 1px $seed-paper-shade;
.seed-packet-tear {
height: 0.6rem;
margin: -0.5rem -0.5rem 0.4rem;
border-bottom: 1px dashed darken($beige, 30%);
background: $seed-paper-shade;
}
.seed-packet-window {
display: block;
width: 100%;
height: 78px;
border: 1px solid $yellow;
object-fit: cover;
}
.seed-packet-name {
display: block;
margin: 0.4rem 0 0.2rem;
padding: 0.1rem;
background: $green;
color: $white;
font-size: 0.8rem;
font-weight: 600;
letter-spacing: 0.04em;
text-align: center;
text-transform: uppercase;
a {
color: $white;
}
}
p,
.seed-packet-line {
display: block;
margin: 0;
color: $brown;
font-size: 0.72rem;
text-align: center;
}
// Whose it is, on a page of other people's seeds.
.seed-packet-owner {
margin-top: 0.25rem;
color: darken($green, 12%);
font-weight: 700;
&.seed-packet-yours {
color: rgba($brown, 0.7);
font-weight: 400;
}
}
.seed-packet-rule {
margin-top: auto;
padding-top: 0.25rem;
border-top: 1px solid $seed-paper-shade;
color: $brown;
font-size: 0.64rem;
text-align: center;
text-transform: uppercase;
}
// Stamped across the picture, the way a packet past its date is marked.
.seed-packet-stamp {
position: absolute;
top: 44%;
left: 50%;
padding: 0 0.5rem;
border: 2px solid #a33;
background: rgba($white, 0.85);
color: #a33;
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
transform: translate(-50%, -50%) rotate(-12deg);
white-space: nowrap;
}
}
.seed-pill {
display: inline-block;
padding: 0 0.4rem;
border: 1px solid $green;
border-radius: 999px;
background: rgba($green, 0.1);
color: darken($green, 12%);
font-size: 0.64rem;
font-weight: 600;
&.seed-pill-hybrid {
border-color: #c77d00;
background: rgba($orange, 0.15);
color: #8a5600;
}
}
// Packets of one variety piled up: two sheets peeking out behind the top one.
// The sheets belong to the pile, so they sit exactly behind the packet.
.seed-stack {
position: relative;
display: inline-block;
.seed-stack-pile {
position: relative;
&::before,
&::after {
content: "";
position: absolute;
z-index: 0;
border: 1px solid $seed-paper-edge;
border-radius: 4px;
background: $seed-paper-shade;
}
&::before {
inset: -5px -6px 5px 6px;
}
&::after {
inset: -10px -12px 10px 12px;
background: $seed-paper-fold;
}
.seed-packet {
position: relative;
z-index: 1;
}
}
.seed-stack-count {
position: absolute;
top: 0.3rem;
right: 0.3rem;
z-index: 2;
padding: 0 0.45rem;
border-radius: 999px;
background: $orange;
color: $black;
font-size: 0.75rem;
font-weight: 700;
}
}
// A pile that opens where it stands, as a React island. The sheets behind it
// slide out when you hover or focus it, and once when the page loads, to say
// it comes apart.
.seed-stack-island {
.seed-stack-toggle {
width: 150px;
font: inherit;
text-align: center;
cursor: pointer;
appearance: none;
transition: transform 0.2s ease;
}
.seed-stack-hint {
color: darken($green, 12%);
font-weight: 700;
i {
display: inline-block;
margin-right: 0.3em;
font-style: normal;
transition: transform 0.2s ease;
}
}
.seed-stack-pile::before,
.seed-stack-pile::after {
transition: transform 0.25s ease;
animation: seed-stack-peek 1.4s 0.9s ease-in-out 1;
}
.seed-stack-pile::after {
animation-delay: 1s;
}
&:hover,
&:focus-within {
.seed-stack-toggle {
transform: translateY(-3px);
}
.seed-stack-pile::before {
transform: translate(9px, -4px) rotate(2deg);
}
.seed-stack-pile::after {
transform: translate(18px, -8px) rotate(4deg);
}
.seed-stack-hint i {
transform: translateX(4px);
}
}
}
@keyframes seed-stack-peek {
0%,
100% {
transform: none;
}
40% {
transform: translate(9px, -4px) rotate(2deg);
}
}
// The opened pile: a green group box in the pile's own place in the shelf, with
// each packet spread out to choose from. The packets fan out from where the
// pile was, and fold back into it on close.
.seed-group {
box-sizing: border-box;
max-width: 100%;
padding: 0.5rem 0.75rem 0.75rem;
border: 2px solid $green;
border-radius: 6px;
background: $seed-wash;
animation: seed-group-open 0.28s ease-out both;
transform-origin: left center;
.seed-group-head {
display: flex;
gap: 1.25rem;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
b {
font-size: 1rem;
}
}
// The gardener whose packets these are.
.seed-group-owner {
display: inline-flex;
gap: 0.4rem;
align-items: center;
margin-right: auto;
margin-left: 0.75rem;
font-size: 0.9rem;
font-weight: 600;
img {
border-radius: 50%;
object-fit: cover;
}
}
.seed-group-close {
padding: 0;
border: 0;
background: none;
color: $green;
font-weight: 600;
cursor: pointer;
}
.seed-group-row {
display: flex;
flex-wrap: wrap;
gap: 0.9rem;
align-items: stretch;
}
.seed-group-packet {
background: $white;
animation: seed-packet-spread 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
animation-delay: calc(var(--i) * 70ms);
.seed-packet-detail {
margin-top: 0.2rem;
font-size: 0.68rem;
}
.seed-packet-rule {
margin-top: 0.4rem;
}
}
.seed-group-foot {
margin-top: 0.6rem;
font-size: 0.85rem;
a {
font-weight: 600;
}
}
&.is-closing {
animation: seed-group-close 0.26s ease-in both;
.seed-group-packet {
animation: seed-packet-fold 0.26s ease-in both;
animation-delay: calc((var(--n) - 1 - var(--i)) * 30ms);
}
}
}
@keyframes seed-group-open {
from {
opacity: 0;
transform: scale(0.92);
}
to {
opacity: 1;
transform: none;
}
}
@keyframes seed-packet-spread {
from {
opacity: 0;
transform: translateX(calc(var(--i) * -60px)) rotate(calc(var(--i) * -3deg)) scale(0.9);
}
to {
opacity: 1;
transform: none;
}
}
@keyframes seed-group-close {
to {
opacity: 0;
transform: scale(0.92);
}
}
@keyframes seed-packet-fold {
to {
opacity: 0;
transform: translateX(calc(var(--i) * -60px)) scale(0.9);
}
}
@media (prefers-reduced-motion: reduce) {
.seed-group,
.seed-group-packet,
.seed-stack-island .seed-stack-pile::before,
.seed-stack-island .seed-stack-pile::after {
animation: none;
}
.seed-stack-island .seed-stack-toggle,
.seed-stack-island .seed-stack-pile::before,
.seed-stack-island .seed-stack-pile::after,
.seed-stack-island .seed-stack-hint i {
transition: none;
}
}
// Whose packet it is, on a page of other people's seeds: a small avatar
// overlapping the packet's corner, with "You have it" when the member already
// holds the variety.
.seed-owned {
position: relative;
display: inline-block;
}
.seed-owner {
position: absolute;
bottom: -10px;
left: -10px;
z-index: 3;
width: 32px;
height: 32px;
overflow: hidden;
border: 2px solid $white;
border-radius: 50%;
background: $white;
box-shadow: 0 1px 3px rgba($black, 0.3);
transition: transform 0.15s ease;
img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
&:hover,
&:focus-visible {
transform: scale(1.12);
}
}
.seed-have-it {
position: absolute;
top: 0.3rem;
left: 0.3rem;
z-index: 2;
padding: 0 0.45rem;
border: 1px solid lighten($green, 25%);
border-radius: 999px;
background: $seed-wash;
color: darken($green, 10%);
font-size: 0.65rem;
font-weight: 700;
}
// The list view: a green row for each shelf, packets indented under a variety.
.seed-list {
background: $white;
.seed-list-shelf th {
background: $green;
color: $white;
a {
color: $white;
}
}
.seed-list-packet td:first-child {
padding-left: 2rem;
}
}
.open-data {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid $seed-rule;
h2 {
margin: 0 0 0.5rem;
padding: 0;
border: 0;
background: none;
box-shadow: none;
color: $brown;
font-size: 1rem;
font-weight: 600;
}
}