generated from tpl/obsidian-sample-plugin
Make details view responsive
This commit is contained in:
parent
67930eb1fd
commit
dc7b84f287
|
@ -79,10 +79,5 @@
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -142,57 +142,72 @@
|
||||||
</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;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
background-color: var(--background-secondary);
|
background-color: var(--background-secondary);
|
||||||
border-radius: var(--radius-l);
|
|
||||||
|
|
||||||
img {
|
|
||||||
border-radius: var(--radius-l);
|
border-radius: var(--radius-l);
|
||||||
max-width: 30%;
|
|
||||||
|
img {
|
||||||
|
border-radius: var(--radius-l);
|
||||||
|
max-width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--size-4-2);
|
||||||
|
padding: var(--size-4-4);
|
||||||
|
|
||||||
|
h2,
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: var(--size-4-2) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authors,
|
||||||
|
.series {
|
||||||
|
font-size: var(--font-small);
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
max-height: 30rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
font-size: var(--font-smaller);
|
||||||
|
color: var(--text-muted);
|
||||||
|
display: flex;
|
||||||
|
gap: var(--size-2-2);
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.book-info {
|
container: book-details-list / inline-size;
|
||||||
display: flex;
|
@container book-details-list (width < 600px) {
|
||||||
flex-direction: column;
|
.book-details {
|
||||||
gap: var(--size-4-2);
|
flex-direction: column;
|
||||||
padding: var(--size-4-4);
|
|
||||||
|
|
||||||
h2,
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr {
|
|
||||||
margin: var(--size-4-2) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.authors,
|
|
||||||
.series {
|
|
||||||
font-size: var(--font-small);
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
max-height: 30rem;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
font-size: var(--font-smaller);
|
|
||||||
color: var(--text-muted);
|
|
||||||
display: flex;
|
|
||||||
gap: var(--size-2-2);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
|
||||||
|
img {
|
||||||
|
max-height: 30rem;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue