Skip to content

Commit

Permalink
Fix type error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Aug 14, 2024
1 parent 9e74554 commit 179c8cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/components/inputs/SelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { cx, interactionRingStyles } from '@/utils/class-names'
import { Listbox, Transition } from '@headlessui/react'
import Image, { ImageProps } from 'next/image'
import React, { Fragment, isValidElement } from 'react'
import { Fragment, ReactNode, isValidElement } from 'react'
import { IoIosArrowDown } from 'react-icons/io'

export type ListItem<AdditionalData = {}> = {
id: string
icon?: ImageProps['src'] | JSX.Element
label: string | React.ReactNode
label: string
customLabel?: ReactNode
disabledItem?: boolean | string
} & AdditionalData

Expand Down Expand Up @@ -76,7 +77,10 @@ export default function SelectInput<AdditionalData = {}>({
/>
))}
<span className='block truncate'>
{selected?.label ?? placeholder ?? ''}
{selected?.customLabel ??
selected?.label ??
placeholder ??
''}
</span>
</span>
{!disabled && (
Expand Down Expand Up @@ -179,7 +183,7 @@ function SelectListItem<AdditionalData>({
['text-gray-500']: item.disabledItem,
})}
>
{item.label}
{item.customLabel ?? item.label}
</span>
</div>
{item.disabledItem && (
Expand Down
7 changes: 5 additions & 2 deletions src/modules/moderator/ModeratorHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ function ModeratorFilter() {
moderators?.forEach((address) => {
options.push({
id: address,
label: <Name address={address} withProfileModal={false} clipText />,
label: address,
customLabel: <Name address={address} withProfileModal={false} clipText />,
icon: (
<AddressAvatar
address={address}
Expand Down Expand Up @@ -103,7 +104,9 @@ function ModeratorFilter() {
renderItem={(item) => (
<div className='flex cursor-pointer items-center gap-2.5 text-base'>
{isValidElement(item.icon) ? item.icon : null}
<span className='line-clamp-1'>{item.label}</span>
<span className='line-clamp-1'>
{item.customLabel ?? item.label}
</span>
</div>
)}
/>
Expand Down

0 comments on commit 179c8cb

Please sign in to comment.