-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7fa3b2
commit 5ecfd6f
Showing
29 changed files
with
158 additions
and
116 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
apps/meteor/client/components/Contextualbar/Contextualbar.tsx
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
apps/meteor/client/components/Contextualbar/ContextualbarDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Contextualbar } from '@rocket.chat/fuselage'; | ||
import { useLayoutSizes, useLayoutContextualBarPosition } from '@rocket.chat/ui-contexts'; | ||
import type { ComponentProps, KeyboardEvent } from 'react'; | ||
import React, { useCallback, useRef } from 'react'; | ||
import type { AriaDialogProps } from 'react-aria'; | ||
import { FocusScope, useDialog } from 'react-aria'; | ||
|
||
import { useRoomToolbox } from '../../views/room/contexts/RoomToolboxContext'; | ||
|
||
type ContextualbarDialogProps = AriaDialogProps & ComponentProps<typeof Contextualbar>; | ||
|
||
const ContextualbarDialog = (props: ContextualbarDialogProps) => { | ||
const ref = useRef(null); | ||
const { dialogProps } = useDialog({ 'aria-labelledby': 'contextualbarTitle', ...props }, ref); | ||
const sizes = useLayoutSizes(); | ||
const position = useLayoutContextualBarPosition(); | ||
const { closeTab } = useRoomToolbox(); | ||
|
||
const callbackRef = useCallback( | ||
(node) => { | ||
if (!node) { | ||
return; | ||
} | ||
|
||
ref.current = node; | ||
node.addEventListener('keydown', (e: KeyboardEvent) => { | ||
if (e.key === 'Escape') { | ||
closeTab(); | ||
} | ||
}); | ||
}, | ||
[closeTab], | ||
); | ||
|
||
return ( | ||
<FocusScope autoFocus restoreFocus> | ||
<Contextualbar ref={callbackRef} width={sizes.contextualBar} position={position} {...dialogProps} {...props} /> | ||
</FocusScope> | ||
); | ||
}; | ||
|
||
export default ContextualbarDialog; |
9 changes: 9 additions & 0 deletions
9
apps/meteor/client/components/Contextualbar/ContextualbarTitle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ContextualbarTitle as ContextualbarTitleComponent } from '@rocket.chat/fuselage'; | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
const ContextualbarTitle = (props: ComponentProps<typeof ContextualbarTitleComponent>) => ( | ||
<ContextualbarTitleComponent id='contextualbarTitle' {...props} /> | ||
); | ||
|
||
export default ContextualbarTitle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.