-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPageSelector.jsx
49 lines (46 loc) · 1.29 KB
/
PageSelector.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use client";
import { useState, useEffect } from "react";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { useRouter } from "next/navigation";
import ThemeSwitcher from "./ThemeSwitcher";
const PageSelector = () => {
const router = useRouter();
const [page, setPage] = useState("explore");
function handlePageChange(page) {
setPage(page);
if (page === "explore") {
router.push("/");
} else if (page === "archived") {
router.push("/archived");
} else if (page === "upload") {
router.push("/upload");
} else if (page === "docs") {
router.push("https://tejasbhovad.github.io/docs/");
}
}
return (
<Select
className="bg-secondary"
onValueChange={handlePageChange}
defaultValue="explore"
placeholder="Explore"
>
<SelectTrigger className="w-32 bg-secondary border-[1.5px] border-border">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="explore">Explore</SelectItem>
<SelectItem value="archived">Archived</SelectItem>
<SelectItem value="docs"><docs></SelectItem>
<ThemeSwitcher isMobile={true} />
</SelectContent>
</Select>
);
};
export default PageSelector;