[common/features, apps/cs] refactor: SortSelect 컴포넌트 추가 및 적용

This commit is contained in:
2025-07-02 10:24:47 +09:00
parent bba2b1db2c
commit 20173a24ea
7 changed files with 80 additions and 38 deletions
+6 -2
View File
@@ -21,6 +21,7 @@ import {
SelectTrigger,
SelectValue,
} from "@common/components";
import { SortSelect } from "@/widgets/post";
import {
PostApi,
deleteReasonMessages,
@@ -49,7 +50,9 @@ function RecentPage() {
const { prompt } = useSelectPrompt(selectData);
const { confirm } = useConfirm();
const alert = useAlertStore((state) => state.setMessage);
const [dateRange, setDateRange] = useState<DateRange>();
const [tableSort, setTableSort] = useState("regDt,desc");
const [pagination, setPagination] = useState<PaginationState>({
pageIndex: 0,
pageSize: 10,
@@ -62,17 +65,17 @@ function RecentPage() {
delYn: "N",
frDateYmd: "",
toDateYmd: "",
sort:"regDt,desc"
});
const [isDeletePostData, setIsDeletePostData] = useState(false);
const query = useQuery({
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, pagination],
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, pagination, tableSort],
queryFn: () =>
PostApi.getRecentPostList({
...recentPostQuery,
page: pagination.pageIndex,
size: pagination.pageSize,
sort: tableSort,
}),
placeholderData: keepPreviousData,
});
@@ -342,6 +345,7 @@ function RecentPage() {
))}
</SelectContent>
</Select>
<SortSelect value={tableSort} onValueChange={setTableSort} />
</div>
</div>
</div>