MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / MobileMenu

Function MobileMenu

apps/web/ui/Header/MobileMenu/index.tsx:29–225  ·  view source on GitHub ↗
({
  channels,
  channelName,
  permissions,
  fontColor,
  InternalLink,
  routerAsPath,
  signOut,
  usePath,
}: Props)

Source from the content-addressed store, hash-verified

27}
28
29export default function MobileMenu({
30 channels,
31 channelName,
32 permissions,
33 fontColor,
34 InternalLink,
35 routerAsPath,
36 signOut,
37 usePath,
38}: Props) {
39 const [show, setOpen] = useState(false);
40 const open = () => setOpen(true);
41 const close = () => setOpen(false);
42
43 const paths = {
44 inbox: usePath({ href: '/inbox' }),
45 starred: usePath({ href: '/starred' }),
46 all: usePath({ href: '/all' }),
47 metrics: usePath({ href: '/metrics' }),
48 configurations: usePath({ href: '/configurations' }),
49 branding: usePath({ href: '/branding' }),
50 channels: usePath({ href: '/channels' }),
51 members: usePath({ href: '/members' }),
52 plans: usePath({ href: '/plans' }),
53 };
54
55 return (
56 <>
57 <FiMenu
58 className={styles.open}
59 style={{ color: fontColor }}
60 onClick={open}
61 />
62 <Modal open={show} close={close} size="full">
63 <div className={styles.content}>
64 <div className={styles.header}>
65 <div className={styles.text}>Menu</div>
66 <FiMenu className={styles.close} onClick={close} />
67 </div>
68 <ul className={styles.list}>
69 {permissions.inbox && (
70 <li>
71 <InternalLink
72 onClick={close}
73 className={classNames(styles.link, {
74 [styles.active]: paths.inbox === routerAsPath,
75 })}
76 href="/inbox"
77 >
78 <FiInbox /> Inbox
79 </InternalLink>
80 </li>
81 )}
82 {permissions.starred && (
83 <li>
84 <InternalLink
85 onClick={close}
86 className={classNames(styles.link, {

Callers

nothing calls this directly

Calls 4

usePathFunction · 0.85
closeFunction · 0.85
signOutFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected