From c8978c014f432ce09a57403ff95dd87dd7e4c6d5 Mon Sep 17 00:00:00 2001 From: jenshenJ <91986803+jenshenJ@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:10:22 +0300 Subject: [PATCH 1/2] feat(AsideHeader): add onAllPagesClick callback (#329) * feat(AsideHeader): add onAllPagesClick callback * fix(AsideHeader): update useMemo dependencies --- src/components/AsideHeader/README.md | 1 + .../AsideHeader/__stories__/AsideHeaderShowcase.tsx | 1 + src/components/AsideHeader/types.tsx | 1 + .../AsideHeader/useAsideHeaderInnerContextValue.tsx | 5 +++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/AsideHeader/README.md b/src/components/AsideHeader/README.md index b6e4e69..a062348 100644 --- a/src/components/AsideHeader/README.md +++ b/src/components/AsideHeader/README.md @@ -137,6 +137,7 @@ export const Aside: FC = () => { | onClosePanel | Callback will be called when closing panel. You can add panels via `PanelItems` prop | `() => void;` | | | onMenuItemsChanged | Callback will be called when updating list of the menuItems in `AllPagesPanel` | `(items: Array) => void` | | | onMenuMoreClick | Callback will be called when some items don't fit and "more" button is clicked | `() => void;` | | +| onAllPagesClick | Callback will be called when "All pages" button is clicked | `() => void;` | | | openModalSubscriber | Function notifies `AsideHeader` about Modals visibility changes | `( (open: boolean) => void) => void` | | | panelItems | Items for `Drawer` component. Used for show additional information over main content | [`Array`](./../Drawer/README.md#draweritem-props) | `[]` | | renderContent | Function rendering the main content at the right of the `AsideHeader` | `(data: {size: number}) => React.ReactNode` | | diff --git a/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx b/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx index e91c275..f8ae42a 100644 --- a/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx +++ b/src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx @@ -296,6 +296,7 @@ export const AsideHeaderShowcase: React.FC = ({ setCompact(v); }} onMenuMoreClick={() => console.log('onMenuMoreClick')} + onAllPagesClick={() => console.log('onAllPagesClick')} /> ); diff --git a/src/components/AsideHeader/types.tsx b/src/components/AsideHeader/types.tsx index 4e81f3b..32a1b48 100644 --- a/src/components/AsideHeader/types.tsx +++ b/src/components/AsideHeader/types.tsx @@ -45,6 +45,7 @@ export interface AsideHeaderGeneralProps extends QAProps { onClosePanel?: () => void; onChangeCompact?: (compact: boolean) => void; onMenuMoreClick?: () => void; + onAllPagesClick?: () => void; openModalSubscriber?: (subscriber: OpenModalSubscriber) => void; } diff --git a/src/components/AsideHeader/useAsideHeaderInnerContextValue.tsx b/src/components/AsideHeader/useAsideHeaderInnerContextValue.tsx index 4c1cc2e..5f97c7d 100644 --- a/src/components/AsideHeader/useAsideHeaderInnerContextValue.tsx +++ b/src/components/AsideHeader/useAsideHeaderInnerContextValue.tsx @@ -11,7 +11,7 @@ const EMPTY_MENU_ITEMS: MenuItem[] = []; export const useAsideHeaderInnerContextValue = ( props: AsideHeaderProps & {size: number}, ): AsideHeaderInnerContextType => { - const {size, onClosePanel, menuItems, panelItems, onMenuItemsChanged} = props; + const {size, onClosePanel, menuItems, panelItems, onMenuItemsChanged, onAllPagesClick} = props; const [innerVisiblePanel, setInnerVisiblePanel] = useState(); const ALL_PAGES_MENU_ITEM = React.useMemo(() => { return getAllPagesMenuItem(); @@ -59,10 +59,11 @@ export const useAsideHeaderInnerContextValue = ( { ...ALL_PAGES_MENU_ITEM, current: innerVisiblePanel === InnerPanels.AllPages, + onItemClick: onAllPagesClick, }, ] : menuItems || EMPTY_MENU_ITEMS, - [allPagesIsAvailable, menuItems, innerVisiblePanel, ALL_PAGES_MENU_ITEM], + [allPagesIsAvailable, menuItems, innerVisiblePanel, ALL_PAGES_MENU_ITEM, onAllPagesClick], ); const innerPanelItems = useMemo(() => { From 0d823a02b32cab3248cfc1aa3f77119d60bb368b Mon Sep 17 00:00:00 2001 From: Gravity UI Bot <111915794+gravity-ui-bot@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:19:26 +0300 Subject: [PATCH 2/2] chore(main): release 2.28.0 (#327) --- CHANGELOG.md | 8 ++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be916ce..c8a1dbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.28.0](https://github.com/gravity-ui/navigation/compare/v2.27.0...v2.28.0) (2024-10-24) + + +### Features + +* **AsideHeader:** add onAllPagesClick callback ([#329](https://github.com/gravity-ui/navigation/issues/329)) ([c8978c0](https://github.com/gravity-ui/navigation/commit/c8978c014f432ce09a57403ff95dd87dd7e4c6d5)) +* **TopPanel:** add align prop ([#317](https://github.com/gravity-ui/navigation/issues/317)) ([c85b17b](https://github.com/gravity-ui/navigation/commit/c85b17ba41b26cf1a06d429a1e6a93fcc80ad648)) + ## [2.27.0](https://github.com/gravity-ui/navigation/compare/v2.26.0...v2.27.0) (2024-10-11) diff --git a/package-lock.json b/package-lock.json index 8a249ac..e6c621d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gravity-ui/navigation", - "version": "2.27.0", + "version": "2.28.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gravity-ui/navigation", - "version": "2.27.0", + "version": "2.28.0", "license": "MIT", "dependencies": { "react-transition-group": "^4.4.1", diff --git a/package.json b/package.json index bdaf6d2..9fa65b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gravity-ui/navigation", - "version": "2.27.0", + "version": "2.28.0", "description": "Gravity UI Navigation components", "license": "MIT", "repository": {