MCPcopy Create free account
hub / github.com/electric-sql/electric / LeftMenu

Function LeftMenu

examples/linearlite/src/components/LeftMenu.tsx:22–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20import ProfileMenu from './ProfileMenu'
21
22function LeftMenu() {
23 const ref = useRef<HTMLDivElement>(null)
24 const [showProfileMenu, setShowProfileMenu] = useState(false)
25 const [showAboutModal, setShowAboutModal] = useState(false)
26 const [showIssueModal, setShowIssueModal] = useState(false)
27 const [showPGliteConsoleModal, setShowPGliteConsoleModal] = useState(false)
28 const { showMenu, setShowMenu } = useContext(MenuContext)!
29
30 const classes = classnames(
31 `absolute z-40 lg:static inset-0 transform duration-300 lg:relative lg:translate-x-0 bg-white flex flex-col flex-shrink-0 w-56 font-sans text-sm text-gray-700 border-r border-gray-100 lg:shadow-none justify-items-start`,
32 {
33 '-translate-x-full ease-out shadow-none': !showMenu,
34 'translate-x-0 ease-in shadow-xl': showMenu,
35 }
36 )
37
38 return (
39 <>
40 <div className={classes} ref={ref}>
41 <button
42 type="button"
43 className="flex-shrink-0 px-5 ml-2 lg:hidden h-14"
44 onClick={() => setShowMenu(!showMenu)}
45 >
46 <MenuIcon className="w-3.5 text-gray-500 hover:text-gray-800" />
47 </button>
48
49 {/* Top menu*/}
50 <div className="flex flex-col flex-grow-0 flex-shrink-0 px-5 py-3">
51 <div className="flex items-center justify-between">
52 {/* Project selection */}
53 <Link
54 className="flex items-center p-2 pr-3 rounded cursor-pointer hover:bg-gray-100"
55 to="/"
56 >
57 <img
58 src="/electric-icon.png"
59 className="w-4.5 h-4.5 mr-2.5 rounded-sm"
60 />
61 {/* <div className="flex text-sm items-center justify-center rounded-sm w-4.5 h-4.5 text-white bg-yellow-500 mr-2.5">
62 G
63 </div> */}
64 <span className="flex text-sm font-medium">electric</span>
65 </Link>
66
67 {/* User avatar */}
68 <div className="relative">
69 <button
70 type="button"
71 className="flex items-center justify-center p-2 rounded cursor-pointer hover:bg-gray-100"
72 onClick={() => setShowProfileMenu(!showProfileMenu)}
73 >
74 <Avatar
75 name="Electric"
76 // online={status == 'connected'}
77 online={false}
78 showOffline={true}
79 />

Callers

nothing calls this directly

Calls 1

useContextFunction · 0.85

Tested by

no test coverage detected