@c-rex/components 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-rex/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"files": [
|
|
5
5
|
"src"
|
|
6
6
|
],
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"sideEffects": false,
|
|
8
11
|
"exports": {
|
|
9
12
|
"./autocomplete": {
|
|
@@ -27,8 +30,8 @@
|
|
|
27
30
|
"import": "./src/empty.tsx"
|
|
28
31
|
},
|
|
29
32
|
"./navbar": {
|
|
30
|
-
"types": "./src/navbar.tsx",
|
|
31
|
-
"import": "./src/navbar.tsx"
|
|
33
|
+
"types": "./src/navbar/navbar.tsx",
|
|
34
|
+
"import": "./src/navbar/navbar.tsx"
|
|
32
35
|
},
|
|
33
36
|
"./providers/search-state-wrapper": {
|
|
34
37
|
"types": "./src/providers/search-state-wrapper.tsx",
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
|
|
1
|
+
import React, { FC } from "react";
|
|
3
2
|
import Link from "next/link";
|
|
4
|
-
import { Button } from "@c-rex/ui/button";
|
|
5
3
|
import Image from "next/image";
|
|
4
|
+
import { SingOut, SingInBtn } from "./sing-in-out-btns";
|
|
5
|
+
import { getServerSession } from "next-auth";
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
interface NavBarProps {
|
|
8
9
|
scroll?: boolean;
|
|
9
10
|
large?: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export const NavBar: FC<NavBarProps> = () => {
|
|
13
|
+
export const NavBar: FC<NavBarProps> = async () => {
|
|
14
|
+
const session = await getServerSession()
|
|
15
|
+
|
|
13
16
|
return (
|
|
14
17
|
<header className="sticky top-0 z-40 flex w-full bg-background/60 backdrop-blur-xl transition-all bg-transparent border-b justify-center py-4">
|
|
15
18
|
<div className="container flex justify-between">
|
|
@@ -51,14 +54,14 @@ export const NavBar: FC<NavBarProps> = () => {
|
|
|
51
54
|
</div>
|
|
52
55
|
|
|
53
56
|
<div className="flex items-center space-x-3">
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
57
|
+
{session ? (
|
|
58
|
+
<>
|
|
59
|
+
<span>Welcome, {session.user?.name}</span>
|
|
60
|
+
<SingOut />
|
|
61
|
+
</>
|
|
62
|
+
) : (
|
|
63
|
+
<SingInBtn />
|
|
64
|
+
)}
|
|
62
65
|
</div>
|
|
63
66
|
</div>
|
|
64
67
|
</header>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { signOut, signIn } from "next-auth/react";
|
|
5
|
+
import { Button } from "@c-rex/ui/button";
|
|
6
|
+
|
|
7
|
+
export const SingInBtn = () => (
|
|
8
|
+
<Button
|
|
9
|
+
className="hidden gap-2 px-5 md:flex"
|
|
10
|
+
variant="default"
|
|
11
|
+
size="sm"
|
|
12
|
+
rounded="full"
|
|
13
|
+
onClick={() => signIn("crex", { callbackUrl: "/" })}
|
|
14
|
+
>
|
|
15
|
+
<span>Sign In</span>
|
|
16
|
+
</Button>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const SingOut = () => (
|
|
20
|
+
<Button
|
|
21
|
+
className="hidden gap-2 px-5 md:flex"
|
|
22
|
+
variant="default"
|
|
23
|
+
size="sm"
|
|
24
|
+
rounded="full"
|
|
25
|
+
onClick={() => signOut()}
|
|
26
|
+
>
|
|
27
|
+
<span>Sign out</span>
|
|
28
|
+
</Button>
|
|
29
|
+
);
|