@camped-layout/user-dropdown
Advanced tools
Comparing version
@@ -9,2 +9,3 @@ 'use client'; | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const lucide_react_1 = require("lucide-react"); | ||
const react_1 = require("next-auth/react"); | ||
@@ -17,3 +18,2 @@ const next_themes_1 = require("next-themes"); | ||
const popover_1 = require("@camped-ui/popover"); | ||
const icon_1 = require("@camped-social/icon"); | ||
const UserDropDown = ({ user, name }) => { | ||
@@ -25,9 +25,9 @@ var _a; | ||
} | ||
return ((0, jsx_runtime_1.jsx)("div", { className: 'relative inline-block text-left', children: (0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(card_1.Card, { className: 'bg-secondary rounded-md', children: (0, jsx_runtime_1.jsxs)(avatar_1.Avatar, { className: 'h-10 w-10 rounded-md', children: [(0, jsx_runtime_1.jsx)(avatar_1.AvatarImage, { src: user === null || user === void 0 ? void 0 : user.image }), (0, jsx_runtime_1.jsx)(avatar_1.AvatarFallback, { children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { name: 'Profile', color: theme === 'dark' ? '#fff' : '#000' }) })] }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: 'w-full rounded-md bg-background p-2 sm:w-56', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', children: [(0, jsx_runtime_1.jsx)(icon_1.Icon, { name: 'user', className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: name || ((_a = user === null || user === void 0 ? void 0 : user.name) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || (user === null || user === void 0 ? void 0 : user.email) })] }), (0, jsx_runtime_1.jsxs)(link_1.default, { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', href: '/profile', children: [(0, jsx_runtime_1.jsx)(icon_1.Icon, { name: 'User', className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: "My Profile" })] }), (0, jsx_runtime_1.jsxs)("button", { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', onClick: () => { | ||
return ((0, jsx_runtime_1.jsx)("div", { className: 'relative inline-block text-left', children: (0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(card_1.Card, { className: 'bg-secondary rounded-md', children: (0, jsx_runtime_1.jsxs)(avatar_1.Avatar, { className: 'h-10 w-10 rounded-md', children: [(0, jsx_runtime_1.jsx)(avatar_1.AvatarImage, { src: user === null || user === void 0 ? void 0 : user.image }), (0, jsx_runtime_1.jsx)(avatar_1.AvatarFallback, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.User, { color: theme === 'dark' ? '#fff' : '#000' }) })] }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: 'w-full rounded-md bg-background p-2 sm:w-56', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', children: [(0, jsx_runtime_1.jsx)(lucide_react_1.User, { className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: name || ((_a = user === null || user === void 0 ? void 0 : user.name) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || (user === null || user === void 0 ? void 0 : user.email) })] }), (0, jsx_runtime_1.jsxs)(link_1.default, { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', href: '/profile', children: [(0, jsx_runtime_1.jsx)(lucide_react_1.User, { className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: "My Profile" })] }), (0, jsx_runtime_1.jsxs)("button", { className: 'relative flex w-full items-center justify-start space-x-2 rounded-md p-2 text-left text-sm transition-all duration-75 ', onClick: () => { | ||
(0, react_1.signOut)({ | ||
callbackUrl: '/', | ||
}); | ||
}, children: [(0, jsx_runtime_1.jsx)(icon_1.Icon, { name: 'LogOut', className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: "Sign out" })] })] }) })] }) })); | ||
}, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.LogOut, { className: 'mr-2 h-4 w-4' }), (0, jsx_runtime_1.jsx)("p", { className: 'text-sm', children: "Sign out" })] })] }) })] }) })); | ||
}; | ||
exports.UserDropDown = UserDropDown; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@camped-layout/user-dropdown", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.tsx", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7845
-2.55%102
-2.86%