mango-v4-ui/components/TokenSelect.tsx

41 lines
1.1 KiB
TypeScript
Raw Normal View History

import { ChevronDownIcon } from '@heroicons/react/solid'
2022-07-05 20:37:49 -07:00
import Image from 'next/image'
import mangoStore from '../store/state'
type TokenSelectProps = {
token: string
2022-07-16 04:22:59 -07:00
showTokenList: (x: any) => void
type: 'input' | 'output'
2022-07-05 20:37:49 -07:00
}
2022-07-16 04:22:59 -07:00
const TokenSelect = ({ token, showTokenList, type }: TokenSelectProps) => {
2022-07-05 20:37:49 -07:00
const group = mangoStore((s) => s.group)
2022-07-05 20:37:49 -07:00
if (!group) return null
2022-07-05 20:37:49 -07:00
return (
<>
<div
2022-07-16 04:22:59 -07:00
onClick={() => showTokenList(type)}
className="default-transition flex h-full items-center rounded-lg rounded-r-none py-2 px-3 text-th-fgd-2 hover:cursor-pointer hover:bg-th-bkg-2 hover:text-th-fgd-1"
2022-07-15 05:50:29 -07:00
role="button"
2022-07-05 20:37:49 -07:00
>
2022-07-16 04:22:59 -07:00
<div className="mr-2.5 flex min-w-[24px] items-center">
<Image
alt=""
2022-07-15 05:50:29 -07:00
width="24"
height="24"
src={`/icons/${token.toLowerCase()}.svg`}
/>
</div>
2022-07-15 05:50:29 -07:00
<div className="flex w-full items-center justify-between">
<div className="text-xl font-bold">{token}</div>
<ChevronDownIcon className="h-6 w-6" />
</div>
</div>
</>
2022-07-05 20:37:49 -07:00
)
}
export default TokenSelect