Refactor search.tsx to use preact/hooks
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { IDBPDatabase } from "idb";
|
import { IDBPDatabase } from "idb";
|
||||||
import { ChatStore } from "./app";
|
import { ChatStore } from "./app";
|
||||||
import { useState } from "react";
|
import { StateUpdater, useRef, useState } from "preact/hooks";
|
||||||
import { StateUpdater, useRef } from "preact/hooks";
|
|
||||||
|
|
||||||
interface ChatStoreSearchResult {
|
interface ChatStoreSearchResult {
|
||||||
key: IDBValidKey;
|
key: IDBValidKey;
|
||||||
@@ -151,7 +150,7 @@ export default function Search(props: {
|
|||||||
<div>
|
<div>
|
||||||
{searchResult
|
{searchResult
|
||||||
.slice(pageIndex * 10, (pageIndex + 1) * 10)
|
.slice(pageIndex * 10, (pageIndex + 1) * 10)
|
||||||
.map((result) => {
|
.map((result: ChatStoreSearchResult) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="flex justify-start p-1 m-1 rounded border bg-slate-300 cursor-pointer"
|
className="flex justify-start p-1 m-1 rounded border bg-slate-300 cursor-pointer"
|
||||||
|
|||||||
Reference in New Issue
Block a user