Skip to content

Commit 07a90b0

Browse files
committed
fix: select menu
1 parent bcbc85d commit 07a90b0

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/components/Benchmarks/BenchmarkDetail.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { Listbox, Transition } from '@headlessui/react';
99
import { CheckIcon, SelectorIcon } from '@heroicons/react/solid';
1010
import useBenchmarkDetail from '../../hooks/benchmark';
1111

12+
function classNames(...classes: string[]) {
13+
return classes.filter(Boolean).join(' ');
14+
}
15+
1216
const languages = [
1317
{
1418
id: 1,
@@ -37,7 +41,6 @@ type BenchmarkDetailParams = {
3741
const BenchmarkDetail = ({
3842
match,
3943
}: RouteComponentProps<BenchmarkDetailParams>) => {
40-
// const [benchmark, setBenchmark] = useState<BenchmarkModel>();
4144
const [selected, setSelected] = useState(languages[0]);
4245

4346
//Get monaco instance to access code later
@@ -82,8 +85,6 @@ const BenchmarkDetail = ({
8285
}
8386
}
8487

85-
console.log(benchmarkData);
86-
8788
return (
8889
<Page>
8990
<Header
@@ -137,12 +138,14 @@ const BenchmarkDetail = ({
137138
{languages.map((language) => (
138139
<Listbox.Option
139140
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+
}
146149
value={language}
147150
>
148151
{({ selected, active }) => (
@@ -167,12 +170,12 @@ const BenchmarkDetail = ({
167170

168171
{selected ? (
169172
<span
170-
className={
173+
className={classNames(
171174
active
172175
? '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+
)}
176179
>
177180
<CheckIcon
178181
className="h-5 w-5"

0 commit comments

Comments
 (0)