Skip to content

Commit 20fc03d

Browse files
authored
Merge pull request #3251 from codecrafters-io/fix-test-results-bar-height
fix(course-page): reduce test results bar height to 75vh
2 parents faed941 + ace996b commit 20fc03d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

app/components/course-page/test-results-bar/index.hbs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
<div
2-
class="bg-gray-900 border-t border-gray-800 dark flex flex-col items-center"
3-
style={{if this.isExpanded this.customHeight}}
2+
class="bg-gray-900 border-t border-gray-800 dark flex flex-col items-center {{if this.isExpanded 'rounded-t-lg'}}"
3+
style={{this.containerStyle}}
44
data-test-test-results-bar
55
...attributes
66
>
77
{{#if this.isExpanded}}
88
{{! template-lint-disable no-pointer-down-event-binding }}
99
<div
10-
class="absolute bg-gray-700 hover:bg-gray-500 cursor-ns-resize h-1 rounded-sm top-1 w-12 z-10"
10+
class="group/resize-handler h-3 bg-transparent absolute top-0 left-0 right-0 flex items-center justify-center cursor-ns-resize z-10"
1111
role="button"
1212
{{on "mousedown" this.startResize}}
1313
{{on "touchstart" this.startResize}}
1414
data-test-resize-handler
1515
>
16-
<div class="absolute -top-1.5 left-0 right-0 h-4 bg-transparent"></div>
16+
<div class="bg-gray-700 group-hover/resize-handler:bg-gray-500 h-0.5 rounded-sm w-16">
17+
</div>
1718
</div>
1819
{{/if}}
1920

20-
<div
21-
class="relative w-full max-w-(--breakpoint-lg) xl:max-w-(--breakpoint-xl) flex flex-col grow overflow-auto {{unless this.isExpanded 'h-0'}}"
22-
data-test-contents
23-
>
21+
<div class="relative w-full flex flex-col grow overflow-auto {{unless this.isExpanded 'h-0'}}" data-test-contents>
2422
{{#if this.isExpanded}}
2523
<CoursePage::TestResultsBar::TopSection
2624
@onCollapseButtonClick={{this.handleCollapseButtonClick}}

app/components/course-page/test-results-bar/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class TestResultsBar extends Component<Signature> {
2424
@service declare coursePageState: CoursePageStateService;
2525
@service declare authenticator: AuthenticatorService;
2626
@tracked activeTabSlug = 'logs'; // 'logs' | 'autofix'
27-
@tracked customHeight = htmlSafe('height: 100vh');
27+
@tracked customHeight = '75vh';
2828

2929
get availableTabSlugs() {
3030
if (this.args.activeStep.type === 'CourseStageStep') {
@@ -44,6 +44,14 @@ export default class TestResultsBar extends Component<Signature> {
4444
}
4545
}
4646

47+
get containerStyle() {
48+
if (this.isExpanded) {
49+
return htmlSafe(`height: ${this.customHeight}`);
50+
} else {
51+
return htmlSafe('height: auto');
52+
}
53+
}
54+
4755
get isCollapsed() {
4856
return !this.isExpanded;
4957
}
@@ -65,14 +73,14 @@ export default class TestResultsBar extends Component<Signature> {
6573
@action
6674
handleMouseResize(event: MouseEvent) {
6775
const newHeight = window.innerHeight - event.clientY;
68-
this.customHeight = htmlSafe(`height: min(100vh, ${newHeight}px)`);
76+
this.customHeight = `max(250px, min(calc(100vh - 20px), ${newHeight}px))`;
6977
}
7078

7179
@action
7280
handleTouchResize(event: TouchEvent) {
7381
const touch = event.touches[0] as Touch;
7482
const newHeight = window.innerHeight - touch.clientY;
75-
this.customHeight = htmlSafe(`height: ${newHeight}px`);
83+
this.customHeight = `max(250px, min(calc(100vh - 20px), ${newHeight}px))`;
7684
}
7785

7886
@action

0 commit comments

Comments
 (0)