-
Notifications
You must be signed in to change notification settings - Fork 274
docs(ui5-shellbar): adjust samples to UXC guidelines #11340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dobrinyonkov
wants to merge
3
commits into
main
Choose a base branch
from
shellbar-samples-uxc-adjust
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 52 additions & 12 deletions
64
packages/website/docs/_samples/fiori/ShellBar/Advanced/main.js
This file contains hidden or 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 |
---|---|---|
@@ -1,34 +1,74 @@ | ||
import "@ui5/webcomponents/dist/Avatar.js"; | ||
import "@ui5/webcomponents/dist/Button.js"; | ||
import "@ui5/webcomponents/dist/Input.js"; | ||
import "@ui5/webcomponents/dist/ListItemStandard.js"; | ||
import "@ui5/webcomponents/dist/Popover.js"; | ||
import "@ui5/webcomponents/dist/Title.js"; | ||
import "@ui5/webcomponents/dist/ToggleButton.js"; | ||
import "@ui5/webcomponents/dist/List.js"; | ||
import "@ui5/webcomponents-fiori/dist/UserMenu.js"; | ||
import "@ui5/webcomponents-fiori/dist/UserMenuAccount.js"; | ||
import "@ui5/webcomponents-fiori/dist/UserMenuItem.js"; | ||
|
||
import "@ui5/webcomponents-fiori/dist/ShellBar.js"; | ||
import "@ui5/webcomponents-fiori/dist/ShellBarSearch.js"; | ||
import "@ui5/webcomponents-fiori/dist/SearchItem.js"; | ||
import "@ui5/webcomponents-fiori/dist/SearchScope.js"; | ||
|
||
import "@ui5/webcomponents-icons/dist/da.js"; | ||
import "@ui5/webcomponents-icons/dist/da-2.js"; | ||
import "@ui5/webcomponents-icons/dist/nav-back.js"; | ||
import "@ui5/webcomponents-icons/dist/sys-find.js"; | ||
import "@ui5/webcomponents-icons/dist/settings.js"; | ||
import "@ui5/webcomponents-icons/dist/edit.js"; | ||
import "@ui5/webcomponents-icons/dist/sys-help.js"; | ||
import "@ui5/webcomponents-icons/dist/log.js"; | ||
import "@ui5/webcomponents-icons/dist/action-settings.js"; | ||
import "@ui5/webcomponents-icons/dist/official-service.js"; | ||
|
||
const shellbar = document.getElementById("shellbar"); | ||
const actionPopover = document.getElementById("action-popover"); | ||
const menu = document.getElementById("userMenu"); | ||
|
||
shellbar.addEventListener("ui5-profile-click", (event) => { | ||
actionPopover.opener = event.detail.targetRef; | ||
actionPopover.open = true; | ||
menu.opener = event.detail.targetRef; | ||
menu.open = true; | ||
}); | ||
|
||
[...document.querySelectorAll("ui5-toggle-button")].forEach(el => { | ||
el.addEventListener("click", event => { | ||
const toggleButton = event.target; | ||
toggleButton.icon = toggleButton.pressed ? "sap-icon://da-2" : "sap-icon://da"; | ||
}); | ||
}); | ||
}); | ||
|
||
const scopeData = [ | ||
{ name: "Laptop", scope: "products" }, | ||
{ name: "Leave Requests", scope: "apps" }, | ||
{ name: "Log work", scope: "apps" }, | ||
{ name: "Manage Products", scope: "apps" }, | ||
{ name: "Mobile Phones", scope: "products" }, | ||
{ name: "Tablet", scope: "products" }, | ||
]; | ||
|
||
function createScopeItems(scope) { | ||
let filterData = []; | ||
|
||
if (!scope) { | ||
filterData = scopeData; | ||
} else { | ||
filterData = scopeData.filter(item => item.scope === scope); | ||
} | ||
|
||
filterData.forEach(item => { | ||
const searchItem = document.createElement("ui5-search-item"); | ||
searchItem.text = item.name; | ||
searchItem.scopeName = item.scope; | ||
searchScope.appendChild(searchItem); | ||
}); | ||
} | ||
|
||
const searchScope = document.getElementById("search-scope"); | ||
|
||
createScopeItems(); | ||
|
||
searchScope.addEventListener("ui5-scope-change", (event) => { | ||
const scope = event.detail.scope.text === "All" ? "" : event.detail.scope.text.toLowerCase(); | ||
|
||
searchScope.items.forEach(item => { | ||
item.remove(); | ||
}); | ||
|
||
createScopeItems(scope); | ||
}); |
This file contains hidden or 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 | ||||
---|---|---|---|---|---|---|
|
@@ -9,39 +9,37 @@ | |||||
<link rel="stylesheet" href="./main.css"> | ||||||
</head> | ||||||
|
||||||
<body style="background-color: var(--sapBackgroundColor);height: 400px;"> | ||||||
<body style="background-color: var(--sapBackgroundColor);height: 500px;"> | ||||||
<!-- playground-fold-end --> | ||||||
|
||||||
<ui5-shellbar id="shellbar" primary-title="Corporate Portal" secondary-title="secondary title" | ||||||
notifications-count="99+" show-notifications=""> | ||||||
<ui5-shellbar id="shellbar" primary-title="Corporate Portal" notifications-count="99+" show-notifications> | ||||||
<ui5-avatar slot="profile"> | ||||||
<img src="../assets/images/avatars/woman_avatar_5.png" /> | ||||||
</ui5-avatar> | ||||||
<ui5-toggle-button icon="sap-icon://da" slot="assistant"></ui5-toggle-button> | ||||||
<img slot="logo" src="../assets/images/sap-logo-svg.svg" /> | ||||||
<ui5-button icon="nav-back" slot="startButton"></ui5-button> | ||||||
|
||||||
<ui5-input slot="searchField"></ui5-input> | ||||||
<ui5-li slot="menuItems">Application 1</ui5-li> | ||||||
<ui5-li slot="menuItems">Application 2</ui5-li> | ||||||
<ui5-li slot="menuItems">Application 3</ui5-li> | ||||||
<ui5-li slot="menuItems">Application 4</ui5-li> | ||||||
<ui5-li slot="menuItems">Application 5</ui5-li> | ||||||
<ui5-shellbar-search slot="searchField" id="search-scope" show-clear-icon placeholder="Search Apps, Products"> | ||||||
<ui5-search-scope text="All" selected slot="scopes"></ui5-search-scope> | ||||||
<ui5-search-scope text="Apps" slot="scopes"></ui5-search-scope> | ||||||
<ui5-search-scope text="Products" slot="scopes"></ui5-search-scope> | ||||||
</ui5-shellbar-search> | ||||||
</ui5-shellbar> | ||||||
<ui5-popover id="action-popover" placement="Bottom"> | ||||||
<div class="action-popover-header"> | ||||||
<ui5-title style="padding: 0.25rem 1rem 0rem 1rem">An Kimura</ui5-title> | ||||||
</div> | ||||||
<div class="action-popover-content" style="margin-top: 1rem;"> | ||||||
<ui5-list separators="None"> | ||||||
<ui5-li icon="sys-find">App Finder</ui5-li> | ||||||
<ui5-li icon="settings">Settings</ui5-li> | ||||||
<ui5-li icon="edit">Edit Home Page</ui5-li> | ||||||
<ui5-li icon="sys-help">Help</ui5-li> | ||||||
<ui5-li icon="log">Sign out</ui5-li> | ||||||
</ui5-list> | ||||||
</div> | ||||||
</ui5-popover> | ||||||
<ui5-user-menu id="userMenu" opener="btnOpenUserMenu"> | ||||||
<ui5-user-menu-account slot="accounts" | ||||||
avatar-src="../assets/images/avatars/man_avatar_3.png" | ||||||
title-text="Alaina Chevalier" | ||||||
subtitle-text="[email protected]" | ||||||
description="Delivery Manager" | ||||||
selected> | ||||||
</ui5-user-menu-account> | ||||||
<ui5-user-menu-item icon="action-settings" text="Setting" data-id="setting"></ui5-user-menu-item> | ||||||
<ui5-user-menu-item icon="official-service" text="Legal Information"> | ||||||
<ui5-user-menu-item text="Terms of Use" data-id="terms-of-use"></ui5-user-menu-item> | ||||||
<ui5-user-menu-item text="Private Policy" data-id="privacy-policy"></ui5-user-menu-item> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider renaming "Private Policy" to "Privacy Policy" to align with standard terminology.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
</ui5-user-menu-item> | ||||||
<ui5-user-menu-item icon="message-information" text="About" data-id="about"></ui5-user-menu-item> | ||||||
</ui5-user-menu> | ||||||
<!-- playground-fold --> | ||||||
<script type="module" src="main.js"></script> | ||||||
</body> | ||||||
|
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using a more efficient method such as setting searchScope.innerHTML to an empty string if supported, to remove all search items and improve maintainability.
Copilot uses AI. Check for mistakes.