Compare commits

...

2 Commits

Author SHA1 Message Date
Will Miao
908016cbd6 fix(recipe modal): compact layout on short viewports (#891) 2026-04-09 22:46:25 +08:00
Will Miao
a5ac9cf81b Revert "fix(recipes): make recipe modal viewport-safe (#891)"
This reverts commit 51fe7aa07e.
2026-04-09 22:28:29 +08:00
2 changed files with 42 additions and 39 deletions

View File

@@ -5,8 +5,7 @@
top: var(--header-height, 48px); /* Start below the header */ top: var(--header-height, 48px); /* Start below the header */
left: 0; left: 0;
width: 100%; width: 100%;
height: calc(100vh - var(--header-height, 48px)); /* Fallback for browsers without dvh */ height: calc(100% - var(--header-height, 48px)); /* Adjust height to exclude header */
height: calc(100dvh - var(--header-height, 48px)); /* Adjust height to exclude header */
background: rgba(0, 0, 0, 0.2); /* 调整为更淡的半透明黑色 */ background: rgba(0, 0, 0, 0.2); /* 调整为更淡的半透明黑色 */
z-index: var(--z-modal); z-index: var(--z-modal);
overflow: auto; /* Change from hidden to auto to allow scrolling */ overflow: auto; /* Change from hidden to auto to allow scrolling */
@@ -24,8 +23,7 @@ body.modal-open {
position: relative; position: relative;
max-width: 800px; max-width: 800px;
height: auto; height: auto;
max-height: calc(100vh - var(--header-height, 48px) - 5.5rem); /* Fallback for browsers without dvh */ max-height: calc(100vh - var(--header-height, 48px) - 5.5rem); /* Subtract header height and modal margins */
max-height: calc(100dvh - var(--header-height, 48px) - 5.5rem); /* Subtract header height and modal margins */
margin: 1rem auto; /* Keep reduced top margin */ margin: 1rem auto; /* Keep reduced top margin */
background: var(--lora-surface); background: var(--lora-surface);
border-radius: var(--border-radius-base); border-radius: var(--border-radius-base);

View File

@@ -214,15 +214,11 @@
#recipeModal .modal-content { #recipeModal .modal-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 960px;
width: min(960px, calc(100vw - 2rem));
max-height: calc(100vh - var(--header-height, 48px) - 2rem);
max-height: calc(100dvh - var(--header-height, 48px) - 2rem);
} }
#recipeModal .modal-body { #recipeModal .modal-body {
display: grid; display: flex;
grid-template-rows: auto minmax(0, 1fr); flex-direction: column;
gap: var(--space-2); gap: var(--space-2);
flex: 1 1 auto; flex: 1 1 auto;
min-height: 0; min-height: 0;
@@ -236,14 +232,12 @@
gap: var(--space-2); gap: var(--space-2);
flex-shrink: 0; flex-shrink: 0;
margin-bottom: var(--space-2); margin-bottom: var(--space-2);
align-items: start;
} }
/* Recipe Preview */ /* Recipe Preview */
.recipe-preview-container { .recipe-preview-container {
width: 100%; width: 100%;
height: clamp(220px, 32vh, 360px); height: 360px;
height: clamp(220px, 32dvh, 360px);
border-radius: var(--border-radius-sm); border-radius: var(--border-radius-sm);
overflow: hidden; overflow: hidden;
background: var(--lora-surface); background: var(--lora-surface);
@@ -397,8 +391,7 @@
/* Generation Parameters */ /* Generation Parameters */
.recipe-gen-params { .recipe-gen-params {
height: clamp(220px, 32vh, 360px); height: 360px;
height: clamp(220px, 32dvh, 360px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@@ -672,7 +665,6 @@
gap: 10px; gap: 10px;
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: hidden;
} }
.recipe-checkpoint-container { .recipe-checkpoint-container {
@@ -1044,36 +1036,62 @@
} }
} }
@media (max-height: 960px) { @media (max-height: 860px) {
#recipeModal .modal-content { #recipeModal .modal-content {
max-height: calc(100vh - var(--header-height, 48px) - 1rem); padding-top: var(--space-2);
max-height: calc(100dvh - var(--header-height, 48px) - 1rem); padding-bottom: var(--space-2);
padding: var(--space-2);
} }
.recipe-modal-header { .recipe-modal-header {
padding-bottom: 8px; padding-bottom: 6px;
margin-bottom: 8px; margin-bottom: 8px;
} }
.recipe-modal-header h2 { .recipe-modal-header h2 {
max-height: 1.3em; font-size: 1.25em;
-webkit-line-clamp: 1; max-height: 2.5em;
}
.recipe-tags-container {
margin-bottom: 6px;
} }
.recipe-top-section { .recipe-top-section {
grid-template-columns: 1fr; grid-template-columns: 1fr;
gap: var(--space-1); gap: var(--space-1);
margin-bottom: var(--space-1);
}
.recipe-preview-container {
display: none;
} }
.recipe-preview-container,
.recipe-gen-params { .recipe-gen-params {
height: clamp(180px, 28vh, 300px); height: auto;
height: clamp(180px, 28dvh, 300px); max-height: 210px;
} }
.recipe-gen-params h3 { .recipe-gen-params h3 {
margin-bottom: var(--space-1); margin-bottom: var(--space-1);
font-size: 1.05em;
}
.gen-params-container {
gap: var(--space-1);
}
.param-content {
max-height: 90px;
padding: 10px;
}
.param-textarea {
min-height: 100px;
}
.other-params {
margin-top: 0;
gap: 6px;
} }
.recipe-bottom-section { .recipe-bottom-section {
@@ -1085,19 +1103,6 @@
} }
} }
@media (max-height: 780px) {
.recipe-preview-container,
.recipe-gen-params {
height: clamp(160px, 24vh, 260px);
height: clamp(160px, 24dvh, 260px);
}
.recipe-modal-header {
margin-bottom: 6px;
padding-bottom: 6px;
}
}
.badge-container { .badge-container {
position: relative; position: relative;
display: flex; display: flex;