Skip to content

Commit 30a4e94

Browse files
committed
feat(test-results-bar): introduce Pane component as a wrapper
Extract the TopSection and tab content into a new Pane component to improve structure and reusability. Pane receives activeTabSlug, availableTabSlugs, and onActiveTabSlugChange args and yields its block content, enabling better composition in the TestResultsBar. Update usage in the index template to wrap the conditional sections inside the new Pane component.
1 parent 1587c06 commit 30a4e94

File tree

3 files changed

+51
-19
lines changed

3 files changed

+51
-19
lines changed

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

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,27 @@
2424
>
2525
{{#if this.isExpanded}}
2626
<div class="flex flex-col grow border-b border-gray-800 px-6">
27-
<CoursePage::TestResultsBar::TopSection
27+
<CoursePage::TestResultsBar::Pane
2828
@activeTabSlug={{this.activeTabSlug}}
2929
@onActiveTabSlugChange={{fn (mut this.activeTabSlug)}}
3030
@availableTabSlugs={{this.availableTabSlugs}}
31-
class="mt-3 mb-3"
32-
/>
33-
34-
{{#if (eq this.activeTabSlug "logs")}}
35-
<CoursePage::TestResultsBar::LogsSection
36-
@activeStep={{@activeStep}}
37-
@currentStep={{@currentStep}}
38-
@repository={{@repository}}
39-
class="grow overflow-y-auto"
40-
/>
41-
{{else if (eq this.activeTabSlug "autofix")}}
42-
<CoursePage::TestResultsBar::AutofixSection
43-
@activeStep={{@activeStep}}
44-
@currentStep={{@currentStep}}
45-
@repository={{@repository}}
46-
class="grow overflow-y-auto"
47-
/>
48-
{{/if}}
31+
>
32+
{{#if (eq this.activeTabSlug "logs")}}
33+
<CoursePage::TestResultsBar::LogsSection
34+
@activeStep={{@activeStep}}
35+
@currentStep={{@currentStep}}
36+
@repository={{@repository}}
37+
class="grow overflow-y-auto"
38+
/>
39+
{{else if (eq this.activeTabSlug "autofix")}}
40+
<CoursePage::TestResultsBar::AutofixSection
41+
@activeStep={{@activeStep}}
42+
@currentStep={{@currentStep}}
43+
@repository={{@repository}}
44+
class="grow overflow-y-auto"
45+
/>
46+
{{/if}}
47+
</CoursePage::TestResultsBar::Pane>
4948
</div>
5049

5150
<div
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div ...attributes>
2+
<CoursePage::TestResultsBar::TopSection
3+
@activeTabSlug={{@activeTabSlug}}
4+
@onActiveTabSlugChange={{@onActiveTabSlugChange}}
5+
@availableTabSlugs={{@availableTabSlugs}}
6+
class="mt-3 mb-3"
7+
/>
8+
9+
{{yield}}
10+
</div>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Component from '@glimmer/component';
2+
3+
interface Signature {
4+
Element: HTMLDivElement;
5+
6+
Args: {
7+
activeTabSlug: string;
8+
availableTabSlugs: string[];
9+
onActiveTabSlugChange: (slug: string) => void;
10+
};
11+
12+
Blocks: {
13+
default: [];
14+
};
15+
}
16+
17+
export default class Pane extends Component<Signature> {}
18+
19+
declare module '@glint/environment-ember-loose/registry' {
20+
export default interface Registry {
21+
'CoursePage::TestResultsBar::Pane': typeof Pane;
22+
}
23+
}

0 commit comments

Comments
 (0)