This commit is contained in:
sijinhui 2024-03-26 21:18:43 +08:00
parent f91f4085bc
commit c8b6c31357
3 changed files with 41 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import { Flex } from "antd";
import prisma from "@/lib/prisma";
import { User } from "@prisma/client";
import UsersTable from "../../components/users-table";
import UserTableSearchInput from "../../components/user-table-search";
async function getData() {
return await prisma.user.findMany({
@ -18,6 +19,9 @@ export default async function UsersPage() {
return (
<>
<Flex gap="middle" vertical>
<div style={{ width: "360px;", fontSize: 0 }}>
<UserTableSearchInput />
</div>
<UsersTable users={users} />
</Flex>
</>

View File

@ -63,12 +63,12 @@ const SideBar: React.FC = () => {
setCurrent(e.key);
router.push(e.key);
};
useEffect(() => {
// 如果按钮和路径不相等,那其实应该跳转到按钮的网址
if (current != pathname) {
router.push(current);
}
}, [current, pathname, router]);
// useEffect(() => {
// // 如果按钮和路径不相等,那其实应该跳转到按钮的网址
// if (current != pathname) {
// router.push(current);
// }
// }, [current, pathname, router]);
return (
<>

View File

@ -0,0 +1,31 @@
"use client";
import React from "react";
import { AudioOutlined } from "@ant-design/icons";
import { Input, Space } from "antd";
import type { SearchProps } from "antd/es/input/Search";
const { Search } = Input;
const suffix = (
<AudioOutlined
style={{
fontSize: 16,
color: "#1677ff",
}}
/>
);
const onSearch: SearchProps["onSearch"] = (value, _e, info) =>
console.log(info?.source, value);
const UserTableSearchInput: React.FC = () => (
<Search
placeholder="input search text"
onSearch={onSearch}
enterButton
style={{ width: 304 }}
/>
);
export default UserTableSearchInput;