Make details view responsive

This commit is contained in:
Evan Fiordeliso 2025-07-07 18:41:51 -04:00
parent 67930eb1fd
commit dc7b84f287
3 changed files with 130 additions and 47 deletions

View File

@ -79,10 +79,5 @@
width: 80%; width: 80%;
} }
} }
table {
border-collapse: collapse;
width: 100%;
}
} }
</style> </style>

View File

@ -142,11 +142,12 @@
</div> </div>
<style lang="scss"> <style lang="scss">
@use "../styles/breakpoints";
.book-details-list { .book-details-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--size-4-6); gap: var(--size-4-6);
}
.book-details { .book-details {
display: flex; display: flex;
@ -196,4 +197,18 @@
} }
} }
} }
container: book-details-list / inline-size;
@container book-details-list (width < 600px) {
.book-details {
flex-direction: column;
align-items: center;
img {
max-height: 30rem;
max-width: 100%;
}
}
}
}
</style> </style>

View File

@ -0,0 +1,73 @@
$breakpoints: (
small: 480px,
medium: 720px,
large: 960px,
wide: 1200px,
);
@function next($name) {
$names: map-keys($breakpoints);
$n: index($names, $name);
@if not $n {
@error "Breakpoint `#{$name}` not found in `#{$breakpoints}`.";
}
@return if($n < length($names), nth($names, $n + 1), null);
}
@function min($name) {
$min: map-get($breakpoints, $name);
@return if($min != 0, $min, null);
}
@function max($name) {
$max: map-get($breakpoints, $name);
@return if($max and $max > 0, $max - 0.02, null);
}
@mixin up($name) {
$min: min($name);
@if $min {
@media (min-width: map-get($breakpoints, $name)) {
@content;
}
} @else {
@content;
}
}
@mixin down($name) {
$max: max($name);
@if $max {
@media (max-width: $max) {
@content;
}
} @else {
@content;
}
}
@mixin between($lower, $upper) {
$min: min($lower);
$max: max($upper);
@if $min != null and $max != null {
@media (min-width: $min) and (max-width: $max) {
@content;
}
} @else if $min != null {
@include up($lower) {
@content;
}
} @else if $max != null {
@include down($upper) {
@content;
}
}
}
@mixin only($name) {
$next: next($name);
@include between($name, $next) {
@content;
}
}