@@ -9,6 +9,10 @@ import { Listbox, Transition } from '@headlessui/react';
9
9
import { CheckIcon , SelectorIcon } from '@heroicons/react/solid' ;
10
10
import useBenchmarkDetail from '../../hooks/benchmark' ;
11
11
12
+ function classNames ( ...classes : string [ ] ) {
13
+ return classes . filter ( Boolean ) . join ( ' ' ) ;
14
+ }
15
+
12
16
const languages = [
13
17
{
14
18
id : 1 ,
@@ -37,7 +41,6 @@ type BenchmarkDetailParams = {
37
41
const BenchmarkDetail = ( {
38
42
match,
39
43
} : RouteComponentProps < BenchmarkDetailParams > ) => {
40
- // const [benchmark, setBenchmark] = useState<BenchmarkModel>();
41
44
const [ selected , setSelected ] = useState ( languages [ 0 ] ) ;
42
45
43
46
//Get monaco instance to access code later
@@ -82,8 +85,6 @@ const BenchmarkDetail = ({
82
85
}
83
86
}
84
87
85
- console . log ( benchmarkData ) ;
86
-
87
88
return (
88
89
< Page >
89
90
< Header
@@ -137,12 +138,14 @@ const BenchmarkDetail = ({
137
138
{ languages . map ( ( language ) => (
138
139
< Listbox . Option
139
140
key = { language . id }
140
- className = { ( { active } ) => {
141
- return active
142
- ? 'text-white bg-indigo-600'
143
- : 'text-gray-900' +
144
- 'cursor-default select-none relative py-2 pl-3 pr-9' ;
145
- } }
141
+ className = { ( { active } ) =>
142
+ classNames (
143
+ active
144
+ ? 'text-white bg-indigo-600'
145
+ : 'text-gray-900' ,
146
+ 'cursor-default select-none relative py-2 pl-3 pr-9' ,
147
+ )
148
+ }
146
149
value = { language }
147
150
>
148
151
{ ( { selected, active } ) => (
@@ -167,12 +170,12 @@ const BenchmarkDetail = ({
167
170
168
171
{ selected ? (
169
172
< span
170
- className = {
173
+ className = { classNames (
171
174
active
172
175
? 'text-white'
173
- : 'text-indigo-600' +
174
- 'absolute inset-y-0 right-0 flex items-center pr-4'
175
- }
176
+ : 'text-indigo-600' ,
177
+ 'absolute inset-y-0 right-0 flex items-center pr-4' ,
178
+ ) }
176
179
>
177
180
< CheckIcon
178
181
className = "h-5 w-5"
0 commit comments