Skip to content

Commit 9a7cb49

Browse files
jordalgotheihor
authored andcommitted
Don't render example links nav item if we have no examples
1 parent 388315a commit 9a7cb49

File tree

3 files changed

+4
-54
lines changed

3 files changed

+4
-54
lines changed

src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,7 @@ function App({ testListHeight }: { testListHeight?: number }) {
673673
Clear
674674
</button>
675675
</div>
676-
<div className="line-nav-item">
677-
<Examples handleLoadExample={handleLoadExample} />
678-
</div>
676+
<Examples handleLoadExample={handleLoadExample} />
679677
<div className="line-nav-item">
680678
<div className="file-input-container">
681679
<input

src/__snapshots__/App.test.tsx.snap

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ exports[`App renders the correct starting elements 1`] = `
2424
Clear
2525
</button>
2626
</div>
27-
<div
28-
class="line-nav-item"
29-
>
30-
<label>
31-
Examples:
32-
</label>
33-
<select
34-
id="log-example-dropdown"
35-
/>
36-
<button
37-
class="nav-button"
38-
id="load-example"
39-
>
40-
Load
41-
</button>
42-
</div>
4327
<div
4428
class="line-nav-item"
4529
>
@@ -108,22 +92,6 @@ exports[`App renders the log visualizer when text is pasted 1`] = `
10892
Clear
10993
</button>
11094
</div>
111-
<div
112-
class="line-nav-item"
113-
>
114-
<label>
115-
Examples:
116-
</label>
117-
<select
118-
id="log-example-dropdown"
119-
/>
120-
<button
121-
class="nav-button"
122-
id="load-example"
123-
>
124-
Load
125-
</button>
126-
</div>
12795
<div
12896
class="line-nav-item"
12997
>
@@ -558,22 +526,6 @@ exports[`App renders the log visualizer when text is pasted 2`] = `
558526
Clear
559527
</button>
560528
</div>
561-
<div
562-
class="line-nav-item"
563-
>
564-
<label>
565-
Examples:
566-
</label>
567-
<select
568-
id="log-example-dropdown"
569-
/>
570-
<button
571-
class="nav-button"
572-
id="load-example"
573-
>
574-
Load
575-
</button>
576-
</div>
577529
<div
578530
class="line-nav-item"
579531
>

src/components.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ export function Examples({
206206
handleLoadExample(selectedOption);
207207
}, [selectedOption]);
208208

209-
if (exampleLinks) {
209+
if (exampleLinks && exampleLinks.length !== 0) {
210210
return (
211-
<>
211+
<div className="line-nav-item">
212212
<label>Examples:</label>
213213
<select
214214
id="log-example-dropdown"
@@ -226,7 +226,7 @@ export function Examples({
226226
<button id="load-example" className="nav-button" onClick={onLoad}>
227227
Load
228228
</button>
229-
</>
229+
</div>
230230
);
231231
} else {
232232
return <></>;

0 commit comments

Comments
 (0)