Skip to content

Commit 1601186

Browse files
committed
feat(detector): toggle file and shows smell type
1 parent dd20592 commit 1601186

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

detector/src/reporters/layout/example.html

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
8282
<tbody>
8383
{{#each data}}
8484
<tr
85-
class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
85+
onclick="toggleDetails({{@index}})"
86+
class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700 cursor-pointer">
8687
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
8788
{{this.fileName}}
8889
</th>
@@ -93,8 +94,8 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
9394
{{this.smells.length}}
9495
</td>
9596
</tr>
96-
<tr class="hidden">
97-
<td colspan="3" class="p-4" data-testid="{{@index}}-code">
97+
<tr class="hidden" id="details-{{@index}}">
98+
<td colspan="3" class="p-0" data-testid="{{@index}}-code">
9899
{{#each smells}}
99100
<div data-testid="{{@../index}}-smell-name-{{@index}}">{{this.type}}</div>
100101
{{/each }}
@@ -105,12 +106,7 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
105106
</tbody>
106107
</table>
107108
</div>
108-
109109
</div>
110-
111-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
112-
<script>hljs.highlightAll();</script>
113-
114110
<script>
115111
var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
116112
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
@@ -153,6 +149,17 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
153149

154150
});
155151
</script>
152+
153+
<script>
154+
function toggleDetails(index) {
155+
var details = document.getElementById('details-' + index);
156+
details.classList.toggle('hidden');
157+
}
158+
</script>
159+
160+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
161+
<script>hljs.highlightAll();</script>
162+
156163
</body>
157164

158165
</html>

0 commit comments

Comments
 (0)