Skip to content

Commit 499d24d

Browse files
committed
daisyUIとのコンフリクト解消
1 parent 14adca6 commit 499d24d

File tree

1 file changed

+67
-76
lines changed

1 file changed

+67
-76
lines changed

web/app/search/page.tsx

Lines changed: 67 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,73 @@
1-
"use client";
1+
import Link from "next/link";
2+
import { MdHome } from "react-icons/md";
3+
import { MdPeople } from "react-icons/md";
4+
import { MdChat } from "react-icons/md";
5+
import { MdSettings } from "react-icons/md";
26

3-
import type React from "react";
4-
import { useEffect, useState } from "react";
5-
import { useRecommended } from "~/api/user";
6-
7-
import { useModal } from "~/components/common/modal/ModalProvider";
8-
import { HumanListItem } from "~/components/human/humanListItem";
9-
10-
const SearchPage: React.FC = () => {
11-
const [searchWord, setSearchWord] = useState("");
12-
const { data: recommended } = useRecommended();
13-
const { openModal } = useModal();
14-
const [users, setUsers] = useState<
15-
| {
16-
id: number;
17-
guid: string;
18-
name: string;
19-
gender: string;
20-
grade: string;
21-
faculty: string;
22-
department: string;
23-
intro: string;
24-
pictureUrl: string;
25-
}[]
26-
| null
27-
>(null);
28-
29-
useEffect(() => {
30-
if (recommended) {
31-
setUsers(recommended);
32-
}
33-
}, [recommended]);
34-
35-
function searchByUserName() {
36-
const filteredUsers = recommended?.filter((user) =>
37-
user.name.toLowerCase().includes(searchWord.toLowerCase()),
38-
);
39-
setUsers(filteredUsers || null);
40-
}
7+
type Props = {
8+
activeTab: "0_home" | "1_friends" | "2_chat" | "3_settings" | "4_search";
9+
};
4110

11+
function BottomBarCell({
12+
label,
13+
href,
14+
iconComponent,
15+
isActive,
16+
}: {
17+
label: string;
18+
href: string;
19+
iconComponent: React.ReactNode;
20+
isActive: boolean;
21+
}) {
4222
return (
43-
<div className="flex min-h-screen items-center justify-center bg-gray-100">
44-
<div className="card w-96 bg-white p-6 shadow-md">
45-
<h2 className="mb-4 font-bold text-2xl">Search</h2>
46-
47-
<div className="form-control mb-4">
48-
<label htmlFor="searchInput" className="label">
49-
<span className="label-text">Enter search term</span>
50-
</label>
51-
<input
52-
type="text"
53-
value={searchWord}
54-
onChange={(e) => setSearchWord(e.target.value)}
55-
placeholder="Type here"
56-
className="input input-bordered w-full"
57-
/>
58-
</div>
23+
<Link
24+
href={href}
25+
className={`focus:bg-gray-300 ${isActive ? "active text-primary" : "text-secondary"}`}
26+
>
27+
{iconComponent}
28+
<span
29+
className={`text-xs ${isActive ? "text-primary" : "text-gray-500"}`}
30+
>
31+
{label}
32+
</span>
33+
</Link>
34+
);
35+
}
5936

60-
<button
61-
type="button"
62-
onClick={searchByUserName}
63-
className="btn btn-primary w-full"
64-
>
65-
Search
66-
</button>
67-
{users?.map((user) => (
68-
<HumanListItem
69-
key={user.id}
70-
id={user.id}
71-
name={user.name}
72-
pictureUrl={user.pictureUrl}
73-
onOpen={() => openModal(user)}
74-
hasDots
75-
></HumanListItem>
76-
))}
77-
</div>
37+
export default function BottomBar(props: Props) {
38+
const { activeTab } = props;
39+
return (
40+
<div className="btm-nav flex max-h-14 w-full flex-row">
41+
<BottomBarCell
42+
label="Home"
43+
href="/home"
44+
isActive={activeTab === "0_home"}
45+
iconComponent={<MdHome className="text-2xl" />}
46+
/>
47+
<BottomBarCell
48+
label="Friends"
49+
href="/friends"
50+
isActive={activeTab === "1_friends"}
51+
iconComponent={<MdPeople className="text-2xl" />}
52+
/>
53+
<BottomBarCell
54+
label="Chat"
55+
href="/chat"
56+
isActive={activeTab === "2_chat"}
57+
iconComponent={<MdChat className="text-2xl" />}
58+
/>
59+
<BottomBarCell
60+
label="Settings"
61+
href="/settings"
62+
isActive={activeTab === "3_settings"}
63+
iconComponent={<MdSettings className="text-2xl" />}
64+
/>
65+
<BottomBarCell
66+
label="Search"
67+
href="/search"
68+
isActive={activeTab === "4_search"}
69+
iconComponent={<MdSettings className="text-2xl" />}
70+
/>
7871
</div>
7972
);
80-
};
81-
82-
export default SearchPage;
73+
}

0 commit comments

Comments
 (0)