-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToolbar.tsx
59 lines (54 loc) · 2.06 KB
/
Toolbar.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react'
import focusLine from '@iconify/icons-ri/focus-line'
import { useSingleton } from '@tippyjs/react'
import shareLine from '@iconify/icons-ri/share-line'
import { Loading, ToolbarTooltip, IconButton } from '@mexit/shared'
import useLayout from '../../Hooks/useLayout'
import { useLayoutStore } from '../../Stores/useLayoutStore'
import { useHelpStore } from '../../Stores/useHelpStore'
import { InfoTools, NodeInfo } from '@mexit/shared'
import BookmarkButton from '../Buttons/BookmarkButton'
import { useEditorStore } from '../../Stores/useEditorStore'
import NodeRenameOnlyTitle from './Rename/NodeRename'
const Toolbar = () => {
const fetchingContent = useEditorStore((state) => state.fetchingContent)
const { toggleFocusMode, getFocusProps } = useLayout()
const focusMode = useLayoutStore((store) => store.focusMode)
const nodeid = useEditorStore((state) => state.node.nodeid)
const [source, target] = useSingleton()
const shortcuts = useHelpStore((store) => store.shortcuts)
const showShareOptions = useLayoutStore((store) => store.showShareOptions)
const toggleShareOptions = useLayoutStore((store) => store.toggleShareOptions)
return (
<NodeInfo {...getFocusProps(focusMode)}>
<NodeRenameOnlyTitle />
{fetchingContent && <Loading dots={3} />}
<InfoTools>
<ToolbarTooltip singleton={source} />
<IconButton
singleton={target}
size={24}
icon={shareLine}
title="Share"
highlight={showShareOptions}
onClick={toggleShareOptions}
/>
{/* <ToolbarTooltip singleton={target} content="Bookmark">
<span tabIndex={0}>
<BookmarkButton nodeid={nodeid} />
</span>
</ToolbarTooltip> */}
<IconButton
singleton={target}
size={24}
icon={focusLine}
title="Focus Mode"
shortcut={shortcuts.toggleFocusMode.keystrokes}
highlight={focusMode.on}
onClick={toggleFocusMode}
/>
</InfoTools>
</NodeInfo>
)
}
export default Toolbar