diff --git a/.changeset/stale-brooms-fry.md b/.changeset/stale-brooms-fry.md index a3804f13eb..ddd7ba09a6 100644 --- a/.changeset/stale-brooms-fry.md +++ b/.changeset/stale-brooms-fry.md @@ -2,4 +2,50 @@ '@backstage/create-app': patch --- -// TODO +You can now add `SidebarGroups` to the current `Sidebar`. This will not affect how the current sidebar is displayed, but allows a customization on how the `MobileSidebar` on smaler screens will look like. A `SidebarGroup` wil be displayed with the given icon in the `MobileSidebar`. + +A `SidebarGroup` can either link to an existing page (e.g. `/search` or `/settings`) or wrap components, which will be displayed in a full screen overlay menu (e.g. `Menu`). + +```diff + + ++ } to="/search"> + ++ + ++ }> + + + + + + ++ + + ++ } ++ to="/settings" ++ > + ++ + +``` + +Additionally you can order the groups differently in the `MobileSidebar` than in the usual `Sidebar` simply by giving a group a priority. The groups will be displayed in a descending order from left to right. + +```diff +} + to="/settings" ++ priority={1} +> + + +``` + +If you decide against adding `SidebarGroups` to your `Sidebar` the `MobileSidebar` will contain one default menu item, which will open a full screen overlay menu displaying all of the content of the current `Sidebar`. + +More information on the `SidebarGroup` & the `MobileSidebar` component can be found in the changeset for the `core-components`. diff --git a/app-config.yaml b/app-config.yaml index 8aa3bc569c..2915a67265 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -23,9 +23,9 @@ app: title: '#backstage' backend: - baseUrl: http://localhost:7000 + baseUrl: http://localhost:7001 listen: - port: 7000 + port: 7001 database: client: sqlite3 connection: ':memory:' diff --git a/docs/getting-started/configure-app-with-plugins.md b/docs/getting-started/configure-app-with-plugins.md index 11e2f4d75a..7f522437da 100644 --- a/docs/getting-started/configure-app-with-plugins.md +++ b/docs/getting-started/configure-app-with-plugins.md @@ -92,12 +92,12 @@ import InternalToolIcon from './internal-tool.icon.svg'; ``` On mobile devices the `Sidebar` is displayed at the bottom of the screen. For -customizing the experience you can group `SidebarItems` in a `SidebarGroup` or -create a `SidebarGroup` with a link. All `SidebarGroups` are displayed in the -bottom navigation with an icon. +customizing the experience you can group `SidebarItems` in a `SidebarGroup` +(Example 1) or create a `SidebarGroup` with a link (Example 2). All +`SidebarGroups` are displayed in the bottom navigation with an icon. ```ts -// ... inside the AppSidebar component +// Example 1 } label="Menu"> ... @@ -105,5 +105,14 @@ bottom navigation with an icon. ``` -If no `SidebarGroup`is provided a default menu will display the `Sidebar` +```ts +// Example 2 +} to="/search"> + ... + + ... + +``` + +If no `SidebarGroup` is provided a default menu will display the `Sidebar` content. diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index 5412412126..87fa8c8470 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -89,7 +89,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => ( - }> + }> {/* Global nav, not org-specific */} diff --git a/packages/core-components/src/layout/Sidebar/MobileSidebar.tsx b/packages/core-components/src/layout/Sidebar/MobileSidebar.tsx index 33505987bc..d7817f3037 100644 --- a/packages/core-components/src/layout/Sidebar/MobileSidebar.tsx +++ b/packages/core-components/src/layout/Sidebar/MobileSidebar.tsx @@ -73,7 +73,7 @@ const useStyles = makeStyles(theme => ({ const sortSidebarGroupsForPriority = (children: React.ReactElement[]) => orderBy( children, - ({ props: { priority } }) => (priority ? priority : -1), + ({ props: { priority } }) => (Number.isInteger(priority) ? priority : -1), 'desc', ); diff --git a/packages/create-app/templates/default-app/packages/app/src/components/Root/Root.tsx b/packages/create-app/templates/default-app/packages/app/src/components/Root/Root.tsx index 23670dcb63..c540ce7f59 100644 --- a/packages/create-app/templates/default-app/packages/app/src/components/Root/Root.tsx +++ b/packages/create-app/templates/default-app/packages/app/src/components/Root/Root.tsx @@ -84,7 +84,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => ( - }> + }> {/* Global nav, not org-specific */}