-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: collapse sidebar groups (#33592)
- Loading branch information
1 parent
bd64aed
commit 9274cf4
Showing
15 changed files
with
155 additions
and
106 deletions.
There are no files selected for viewing
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,14 @@ | ||
--- | ||
'@rocket.chat/fuselage-ui-kit': minor | ||
'@rocket.chat/ui-theming': minor | ||
'@rocket.chat/ui-video-conf': minor | ||
'@rocket.chat/uikit-playground': minor | ||
'@rocket.chat/ui-composer': minor | ||
'@rocket.chat/gazzodown': minor | ||
'@rocket.chat/ui-avatar': minor | ||
'@rocket.chat/ui-client': minor | ||
'@rocket.chat/ui-voip': minor | ||
'@rocket.chat/meteor': minor | ||
--- | ||
|
||
Adds ability to collapse/expand sidebar groups |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useLocalStorage } from '@rocket.chat/fuselage-hooks'; | ||
import { useCallback } from 'react'; | ||
|
||
export const useCollapsedGroups = () => { | ||
const [collapsedGroups, setCollapsedGroups] = useLocalStorage<string[]>('sidebarGroups', []); | ||
|
||
const handleCollapsedGroups = useCallback( | ||
(group: string) => { | ||
if (collapsedGroups.includes(group)) { | ||
setCollapsedGroups(collapsedGroups.filter((item) => item !== group)); | ||
} else { | ||
setCollapsedGroups([...collapsedGroups, group]); | ||
} | ||
}, | ||
[collapsedGroups, setCollapsedGroups], | ||
); | ||
|
||
return { collapsedGroups, handleCollapsedGroups }; | ||
}; |
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.