Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit ca3fc60

Browse files
committed
fix: types error
1 parent a950eb8 commit ca3fc60

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/components/ui/Input.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FieldLabel } from "./FieldLabel"
55
type InputProps<TMultiline extends boolean> = {
66
label?: string
77
addon?: string
8-
prefix?: JSX.Element
8+
prefixEle?: JSX.Element
99
isBlock?: boolean
1010
error?: string
1111
help?: React.ReactNode
@@ -18,7 +18,7 @@ export const Input = forwardRef(function Input<
1818
{
1919
label,
2020
addon,
21-
prefix,
21+
prefixEle,
2222
className,
2323
isBlock,
2424
error,
@@ -31,15 +31,15 @@ export const Input = forwardRef(function Input<
3131
: React.ForwardedRef<HTMLInputElement>,
3232
) {
3333
const hasAddon = !!addon
34-
const hasPrefix = !!prefix
34+
const hasPrefix = !!prefixEle
3535
const Component = (multiline ? "textarea" : "input") as any
3636

3737
return (
3838
<div>
3939
{label && <FieldLabel label={label} id={inputProps.id} />}
4040
<div className="flex items-center relative">
41-
{prefix && (
42-
<span className="text-gray-600 absolute left-3">{prefix}</span>
41+
{prefixEle && (
42+
<span className="text-gray-600 absolute left-3">{prefixEle}</span>
4343
)}
4444
<Component
4545
{...inputProps}

src/pages/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Head from "next/head"
22
import { Image } from "~/components/ui/Image"
3-
import { useState, useMemo } from "react"
3+
import React, { useState, useMemo } from "react"
44
import { indexer } from "@crossbell/indexer"
55
import { useCombobox } from "downshift"
66
import { Input } from "../components/ui/Input"
@@ -80,15 +80,15 @@ export default function Home() {
8080
>
8181
<Input
8282
className="w-full focus:border-gray-300 focus:ring-0 border-0 rounded-none"
83-
prefix={
83+
prefixEle={
8484
<MagnifyingGlassIcon className="w-5 h-5 text-gray-500" />
8585
}
8686
{...getInputProps({
87-
onKeyDown: (event) => {
87+
onKeyDown: ((event) => {
8888
if (event.key === "Enter" && !items.length) {
8989
Router.push(`/${inputValue}`)
9090
}
91-
},
91+
}) as React.KeyboardEventHandler<HTMLInputElement>,
9292
})}
9393
/>
9494
<>

0 commit comments

Comments
 (0)