UNPKG

plurality-esm-wrapper

Version:

A React component for social connect popup.

123 lines (109 loc) 5.32 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const antd_1 = require("antd"); const styled_components_1 = __importDefault(require("styled-components")); const profileIcon_1 = __importDefault(require("../../assets/profileIcon")); const icons_1 = require("@ant-design/icons"); const profileIconSmall_1 = __importDefault(require("../../assets/profileIconSmall")); const profileStar_1 = __importDefault(require("../../assets/profileStar")); const ProfileWrapper = (0, styled_components_1.default)(antd_1.Button) ` display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; background-color: ${props => (props.$theme === 'dark' ? '#000000' : '#ffffff')};; padding: 20px 20px; width: 354px; gap: 0.5rem; max-width: 100%; overflow: hidden; box-sizing: border-box; height: ${props => (props.$isOpen ? '430px' : '183px')}; transition: height 0.8s ease; &:hover { background-color: ${props => (props.$theme === 'dark' ? '#000000 !important' : '#ffffff !important')}; color: #fff !important; } .content-wrapper{ display: flex; justify-content: space-around; width: 100%; margin-top: -5px; } .vertical-line { width: 0; height: 150px; border: 1px solid #acacac } `; const ConnectedButtonWrapper = (0, styled_components_1.default)(antd_1.Button) ` width: 100%; max-width: 180px; height: 143px; border-radius: 70px; border: none; background-color:transparent !important; color: #fff; box-sizing: border-box; display: flex; justify-content: space-around; gap: 0.5rem; align-items: center; box-shadow: none; transition: background-color 0.8s ease; .anticon-caret-down{ color: lightgray !important; } &:hover { background-color: #acacac !important; color: #fff !important; } `; const StyledMenu = (0, styled_components_1.default)(antd_1.Menu) ` background-color: #F9F9F9 !important; margin-top: 30px !important; margin-left: -50px !important; width: 260px; border-radius: 25px !important; padding: 0; .ant-dropdown-menu-item{ padding: 0 15px !important; font-family: 'Lexend'; font-size: 16px; font-weight: 400; .basic-info{ display: flex; align-items: center; justify-content: space-between; span{ font-family: 'Lexend'; font-size: 16px; font-weight: 400; } .basic-info-details{ display: flex; justify-content: center; align-items: center; gap: 0.4rem } } } @media (max-width: 768px) { width: 100%; max-width: 260px; } `; const ProfileConnectedButton1 = ({ theme }) => { const [isDropdownOpen, setIsDropdownOpen] = (0, react_1.useState)(false); const toggleDropdown = () => { setIsDropdownOpen(!isDropdownOpen); }; const menu = ((0, jsx_runtime_1.jsxs)(StyledMenu, { "$theme": theme, children: [(0, jsx_runtime_1.jsx)(antd_1.Menu.Item, { children: (0, jsx_runtime_1.jsxs)("div", { className: 'basic-info', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'basic-info-details', children: [(0, jsx_runtime_1.jsx)(profileIconSmall_1.default, {}), (0, jsx_runtime_1.jsx)("span", { children: "John Doe" })] }), (0, jsx_runtime_1.jsxs)("div", { className: 'stars', children: [(0, jsx_runtime_1.jsx)(profileStar_1.default, {}), (0, jsx_runtime_1.jsx)(profileStar_1.default, {}), (0, jsx_runtime_1.jsx)(profileStar_1.default, {}), (0, jsx_runtime_1.jsx)(profileStar_1.default, {})] })] }) }, "1"), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)(antd_1.Menu.Item, { style: { marginTop: '10px' }, children: (0, jsx_runtime_1.jsx)("span", { children: "Profile" }) }, "2"), (0, jsx_runtime_1.jsx)(antd_1.Menu.Item, { style: { marginTop: '10px' }, children: (0, jsx_runtime_1.jsx)("span", { children: "Wallet" }) }, "3"), (0, jsx_runtime_1.jsx)(antd_1.Menu.Item, { style: { marginTop: '10px', marginBottom: '10px' }, children: (0, jsx_runtime_1.jsx)("span", { children: "Settings" }) }, "4"), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)(antd_1.Menu.Item, { style: { marginTop: '10px', marginBottom: '10px' }, children: (0, jsx_runtime_1.jsx)("span", { children: "Logout" }) }, "5")] })); return ((0, jsx_runtime_1.jsx)(ProfileWrapper, { "$isOpen": isDropdownOpen, "$theme": theme, children: (0, jsx_runtime_1.jsxs)("div", { className: 'content-wrapper', children: [(0, jsx_runtime_1.jsx)("div", { className: "vertical-line" }), (0, jsx_runtime_1.jsx)(antd_1.Dropdown, { overlay: menu, trigger: ['hover'], onVisibleChange: toggleDropdown, visible: isDropdownOpen, children: (0, jsx_runtime_1.jsxs)(ConnectedButtonWrapper, { "$isOpen": isDropdownOpen, "$theme": theme, children: [(0, jsx_runtime_1.jsx)(profileIcon_1.default, {}), isDropdownOpen ? (0, jsx_runtime_1.jsx)(icons_1.CaretUpOutlined, {}) : (0, jsx_runtime_1.jsx)(icons_1.CaretDownOutlined, {})] }) })] }) })); }; exports.default = ProfileConnectedButton1;