Skip to content

Commit 295ab9c

Browse files
committed
ユーザ検索で 1 文字以上入力したら表示
1 parent 7cd21c2 commit 295ab9c

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

web/app/home/components/NoMoreUser.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

web/app/home/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useAboutMe, useRecommended } from "~/api/user";
1515
import { Card } from "~/components/Card";
1616
import { DraggableCard } from "~/components/DraggableCard";
1717
import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress";
18-
import NoMoreUser from "./components/NoMoreUser";
18+
import BackgroundText from "../../components/common/BackgroundText";
1919
import PersonDetailedMenu from "./components/PersonDetailedMenu";
2020
import RoundButton from "./components/RoundButton";
2121

@@ -121,7 +121,7 @@ export default function Home() {
121121
return <FullScreenCircularProgress />;
122122
}
123123
if (recommended.size() === 0 && loading === false) {
124-
return <NoMoreUser />;
124+
return <BackgroundText text="「いいね!」を送るユーザーがいません。" />;
125125
}
126126
if (error) throw error;
127127

web/app/search/page.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useAll, useMatched, useMyID, usePendingFromMe } from "~/api/user";
66
import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress";
77
import Search from "~/components/search/search";
88
import Table from "~/components/search/table";
9+
import BackgroundText from "../../components/common/BackgroundText";
910

1011
export default function SearchPage({
1112
searchParams,
@@ -58,10 +59,14 @@ export default function SearchPage({
5859
<div className="w-full">
5960
<h2 className="m-5 mb-4 font-bold text-2xl">ユーザー検索</h2>
6061
<Search placeholder="検索" setSearchString={setQuery} />
61-
{users ? (
62-
<Table users={users} canRequest={canRequest} />
62+
{query !== "" ? (
63+
users.length > 0 ? (
64+
<Table users={users} canRequest={canRequest} />
65+
) : (
66+
<BackgroundText text="ユーザが見つかりません" />
67+
)
6368
) : (
64-
<span>ユーザーが見つかりません</span>
69+
<BackgroundText text="ユーザ名・授業名・タグ名で検索してみましょう" />
6570
)}
6671
</div>
6772
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function BackgroundText({ text }: { text: string }) {
2+
return (
3+
<div className="flex h-full items-center justify-center px-4 text-center">
4+
<p className="text-2xl text-gray-500">{text}</p>
5+
</div>
6+
);
7+
}

0 commit comments

Comments
 (0)