Skip to content

Commit

Permalink
feat(sanity): implement ToolMenu from studio.components in `NavDr…
Browse files Browse the repository at this point in the history
…awer`
  • Loading branch information
hermanwikner authored and rexxars committed Sep 23, 2022
1 parent a80fc64 commit 6b0887d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/sanity/src/studio/components/navbar/NavDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {UserAvatar} from '../../../components/UserAvatar'
import {useWorkspace} from '../../workspace'
import {useRovingFocus} from '../../../components/rovingFocus'
import {Tool} from '../../../config'
import {ToolMenu as DefaultToolMenu} from './tools/ToolMenu'
import {WorkspaceMenuButton} from './workspace'

const Root = styled(Layer)`
Expand Down Expand Up @@ -61,10 +60,7 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
const [closeButtonElement, setCloseButtonElement] = useState<HTMLButtonElement | null>(null)
const [innerCardElement, setInnerCardElement] = useState<HTMLDivElement | null>(null)
const tabIndex = isOpen ? 0 : -1

const {currentUser, navbar, auth} = useWorkspace()

const {ToolMenu = DefaultToolMenu} = navbar?.components || {}
const {auth, currentUser, studio} = useWorkspace()

useRovingFocus({
rootElement: innerCardElement,
Expand All @@ -83,6 +79,8 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
}
}, [closeButtonElement, isOpen])

const {ToolMenu} = studio.components

return (
<Root>
<Backdrop data-open={isOpen} onClick={onClose} />
Expand Down Expand Up @@ -128,9 +126,9 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
<Box flex="auto" overflow="auto" padding={[3, 3, 4]}>
<ToolMenu
activeToolName={activeToolName}
closeDrawer={onClose}
context="drawer"
isDrawerOpen={isOpen}
closeSidebar={onClose}
context="sidebar"
isSidebarOpen={isOpen}
tools={tools}
/>
</Box>
Expand Down

0 comments on commit 6b0887d

Please sign in to comment.