Skip to content

Commit 2437a65

Browse files
authored
Merge pull request #57 from Specy/copilot/create-screen-height-variable
Use --screen-height (100dvh with 100vh fallback) instead of vh units
2 parents b50056e + feee914 commit 2437a65

11 files changed

Lines changed: 20 additions & 12 deletions

File tree

src/components/shared/InteractiveInstructionEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
height: 100%;
128128
justify-content: space-evenly;
129129
"
130-
style={`flex: unset; max-height: ${embedded ? `calc(100vh - ${sizes})` : '16.3rem'}; min-height: 16.3rem;`}
130+
style={`flex: unset; max-height: ${embedded ? `calc(var(--screen-height) - ${sizes})` : '16.3rem'}; min-height: 16.3rem;`}
131131
registers={emulator.registers}
132132
on:registerClick={async (e) => {
133133
const value = e.detail.value

src/components/shared/layout/FloatingContainer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
width: 30rem;
5858
overflow: hidden;
5959
max-width: calc(100vw - 2rem);
60-
top: 50vh;
60+
top: calc(var(--screen-height) * 0.5);
6161
left: 50vw;
6262
transform: translate(-50%, -50%);
6363
border-radius: 0.8rem;

src/components/shared/layout/Sidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
gap: 1rem;
5151
top: 3.2rem;
5252
padding-top: 1rem;
53-
height: calc(100vh - 3.2rem);
53+
height: calc(var(--screen-height) - 3.2rem);
5454
overflow-y: auto;
5555
position: sticky;
5656
}

src/components/specific/project/FloatingLanguageDocumentation.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
max-width: 15rem;
5858
}
5959
.scroll {
60-
height: 80vh;
60+
height: calc(var(--screen-height) * 0.8);
6161
overflow-y: auto;
6262
}
6363
</style>

src/components/specific/project/cpu/RegistersRenderer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
min-width: 8.6rem;
118118
position: relative;
119119
flex: 1;
120-
max-height: calc(100vh - 14.5rem); //HOTFIX
120+
max-height: calc(var(--screen-height) - 14.5rem); //HOTFIX
121121
overflow-y: auto;
122122
overflow-x: hidden;
123123
@media screen and (max-width: 1000px) {

src/components/specific/project/settings/ShortcutEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
display: flex;
105105
padding: 0.8rem;
106106
flex-direction: column;
107-
height: 80vh;
107+
height: calc(var(--screen-height) * 0.8);
108108
padding-top: 0;
109109
gap: 0.4rem;
110110
overflow-y: auto;

src/components/specific/project/testcases/TestcasesEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</script>
5959

6060
<FloatingContainer bind:visible title="Testcases" style="width: 45rem;">
61-
<Column style="height: 80vh; overflow-y: auto;">
61+
<Column style="height: calc(var(--screen-height) * 0.8); overflow-y: auto;">
6262
{#if testcasesResult.length > 0}
6363
<Column
6464
padding="1rem"

src/global.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
body,
2727
html {
28+
--screen-height: 100vh;
2829
min-height: 100%;
2930
height: 100%;
3031
width: 100%;
@@ -36,6 +37,13 @@ html {
3637
overflow-x: hidden;
3738
}
3839

40+
@supports (height: 100dvh) {
41+
body,
42+
html {
43+
--screen-height: 100dvh;
44+
}
45+
}
46+
3947
@media print {
4048
body, html {
4149
height: auto;

src/routes/chat/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
7171
.agent-wrapper {
7272
padding: 0.5rem;
73-
min-height: 65vh;
73+
min-height: calc(var(--screen-height) * 0.65);
7474
min-width: min(55ch, calc(100vw - 1rem));
7575
flex: 1;
7676
height: 100%;

src/routes/exam/session/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@
797797
grid-template-columns: minmax(14rem, 0.95fr) minmax(0, 1.35fr);
798798
gap: 0.8rem;
799799
height: 100%;
800-
min-height: 50vh;
800+
min-height: calc(var(--screen-height) * 0.5);
801801
}
802802
803803
.prompt-pane {
@@ -836,7 +836,7 @@
836836
}
837837
838838
.c-editor-wrap {
839-
min-height: 40vh;
839+
min-height: calc(var(--screen-height) * 0.4);
840840
}
841841
}
842842
</style>

0 commit comments

Comments
 (0)