Skip to content

Commit 54c6207

Browse files
author
shleewhite
committed
fix: simplify currentviewsnippet logic
1 parent b7170ab commit 54c6207

File tree

1 file changed

+10
-12
lines changed
  • website/app/components/doc/code-group

1 file changed

+10
-12
lines changed

website/app/components/doc/code-group/index.gts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,6 @@ export default class DocCodeGroup extends Component<DocCodeGroupSignature> {
115115
return options;
116116
}
117117
118-
get gtsSnippet() {
119-
if (this.isExpanded) {
120-
return this.unescapedGtsSnippet;
121-
}
122-
123-
// When not expanded, show just the content inside the <template> tags
124-
return this.shortenedGtsSnippet;
125-
}
126-
127118
get language() {
128119
if (this.currentView === 'gts' && this.isExpanded) {
129120
return 'gts';
@@ -140,9 +131,16 @@ export default class DocCodeGroup extends Component<DocCodeGroupSignature> {
140131
if (this.currentView === 'js') {
141132
return this.unescapedJsSnippet;
142133
}
143-
return this.currentView === 'hbs'
144-
? this.unescapedHbsSnippet
145-
: this.gtsSnippet;
134+
135+
if (this.currentView === 'gts') {
136+
if (this.isExpanded) {
137+
return this.unescapedGtsSnippet;
138+
}
139+
// When not expanded, show just the content inside the <template> tags
140+
return this.shortenedGtsSnippet;
141+
}
142+
143+
return this.unescapedHbsSnippet;
146144
}
147145
148146
handleLanguageChange = (event: Event) => {

0 commit comments

Comments
 (0)