Skip to content

Commit

Permalink
PS-167 - Allow toggling the sw-page smart bar
Browse files Browse the repository at this point in the history
  • Loading branch information
sydinh committed Apr 5, 2024
1 parent 8f412f2 commit db65b47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-flowers-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-ag/meteor-admin-sdk": patch
---

Allow toggling the sw-page smart bar
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Menu Item

### Add menu item
Add a new menu item to the Shopware admin menu. The content of the menu item module is determined by your `locationId`.
Add a new menu item to the Shopware admin menu. The content of the menu item module is determined by your `locationId`.
A specific view or a set of actions can be triggered based on the `locationId`.

#### Usage:
#### Usage:
```ts
ui.menu.addMenuItem({
label: 'Test item',
locationId: 'your-location-id',
displaySearchBar: true,
displaySmartBar: true,
parent: 'sw-catalogue',
})
```
Expand All @@ -20,6 +21,7 @@ ui.menu.addMenuItem({
| `label` | true | | The label of the tab bar item |
| `locationId` | true | | The id for the content of the menu item module |
| `displaySearchBar` | false | true | Toggles the sw-page search bar on/off |
| `displaySmartBar` | false | true | Toggles the sw-page smart bar on/off |
| `parent` | false | 'sw-extension' | Determines under which main menu entry your item is displayed |
| `position` | false | 110 | Determines the position of your menu item |

Expand All @@ -34,6 +36,7 @@ if (location.is(sw.location.MAIN_HIDDEN)) {
ui.menu.addMenuItem({
label: 'Test item',
displaySearchBar: true,
displaySmartBar: true,
locationId: 'your-location-id',
parent: 'sw-catalogue',
});
Expand All @@ -43,4 +46,4 @@ if (location.is(sw.location.MAIN_HIDDEN)) {
if (location.is('your-location-id')) {
document.body.innerHTML = '<h1 style="text-align: center">Hello from your menu item</h1>';
}
```
```
6 changes: 6 additions & 0 deletions packages/admin-sdk/src/ui/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export type menuItemAdd = {
*/
displaySearchBar?: boolean,

/**
* Toggles the sw-page smart bar on/off.
* Defaults to true.
*/
displaySmartBar?: boolean,

/**
* Determines under which main menu entry your item is displayed.
* Defaults to `sw-extension`.
Expand Down

0 comments on commit db65b47

Please sign in to comment.