![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@one-platform/opc-nav
Advanced tools
opc-nav is a nav bar component developed using lit elements for Red Hat One Platform.
Opc-Nav is a fully customizable web component developed using Lit elements for Red Hat One Platform. Its primarily used as the navigation bar that contains links, menu buttons, and logo.
Opc-Nav is implement under Red Hat design guidelines. Therefore the component uses Red Hat official font. This can be easily imported with google cdn at the top of HTML document.
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Red+Hat+Display&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Red+Hat+Text&display=swap"
rel="stylesheet"
/>
It is a mandatory slot component that contains the product logo, positioned at the left extreme. The best component would be an image component. The height of the image must be within 60px
, which is the height of the navbar. It can be changed with the CSS variable --opc-nav-height
.
<opc-nav>
<img slot="opc-nav-logo" />
<opc-nav-search slot="opc-nav-search"></opc-nav-search>
</opc-nav>
Links are the quick reference links for easy navigation, positioned after the logo along the middle. By default, it could be added with the links
attribute. We can also customize the entire links by using slot opc-nav-menu-links
. This will replace the entire links component container.
<opc-nav>
<img slot="opc-nav-logo" src="" alt="logo" />
<opc-nav-search slot="opc-nav-search"></opc-nav-search>
</opc-nav>
const links = [
{ name: 'Blog', href: '#' },
{ name: 'Documentation', href: '#' },
];
document.querySelector('opc-nav').links = links;
The nav buttons, enable utility actions that enhance the user experience. By default, opc-nav provides two buttons with there corresponding events. Menu buttons can be replaced with the slot opc-nav-btn
. Icon buttons with size of 60px are prefered. activeMenu
property provides active class styling to show users which one is selected. It accepts menu | notification
as value.
Name | Icon | Event |
---|---|---|
Notification Button | Bell Icon | opc-nav-btn-notification:click |
Menu Button | Grid Icon | opc-nav-btn-menu:click |
<opc-nav>
<img slot="opc-nav-logo" src="" alt="logo" />
<opc-nav-search slot="opc-nav-search"></opc-nav-search>
</opc-nav>
<opc-nav>
<img slot="opc-nav-logo" src="" alt="logo" />
<button slot="opc-nav-btn">R</button>
</opc-nav>
opc-nav-search
is a search component for the opc-nav
. It enables modular control on how the search works. It has events opc-nav-search:change
on input change and opc-nav-search:search
on search submit.
<opc-nav>
<opc-nav-search slot="opc-nav-search"></opc-nav-search>
</opc-nav>
document
.querySelector('opc-nav-search')
.addEventListener('opc-nav-search:change', function (event) {
console.log(event.detail.value);
});
document
.querySelector('opc-nav-search')
.addEventListener('opc-nav-search:submit', function (event) {
console.log(event.detail.value);
});
There are total 4 slots of which 3 are optional and one is mandatory
opc-nav-logo
: To set the logo of the application in navbar. Suggested component would be an <img/>
opc-nav-menu-links
: Container component that contains various nav links. If not given and links
attribute will be shown.
opc-nav-search
: Container component that contains the search component.
opc-nav-btn
: The buttons at end of the navbar used for various actions. If not provided by default Notification Bell Button
and Menu Button
will be shown with corresponding events.
links
Array
document.querySelector('opc-nav').links = [{ name: 'Blog', href: '#' }];
activeButton
menu | notification
document.querySelector('opc-nav').activeMenu = 'menu';
value
String
""
document.querySelector('opc-nav-search').value = 'Search';
placeholder
String
Search application, documents, contents etc
document.querySelector('opc-nav-search').placeholder = 'Search';
There are two events emitted by opc-nav both are dispatched on click of navbar notification(bell icon) and menu(grid icon) button.
opc-nav-btn-menu:click
Dispatched on menu(grid icon) button click.
Example:
document
.querySelector('opc-nav')
.addEventListener('opc-nav-btn-menu:click', function (event) {
alert('menu got clicked');
});
opc-nav-btn-notification:click
Dispatched on notification(bell icon) button click.
Example:
document
.querySelector('opc-nav')
.addEventListener('opc-nav-btn-notification:click', function (event) {
alert('notification got clicked');
});
opc-nav-search:change
Dispatched on input change of search.
Example:
document
.querySelector('opc-nav-search')
.addEventListener('opc-nav-search:change', function (event) {
console.log(event.detail.value);
});
opc-nav-btn-notification:click
Dispatched on notification(bell icon) button click.
Example:
document
.querySelector('opc-nav')
.addEventListener('opc-nav-search:submit', function (event) {
alert(event.detail.value);
});
CSS Variable name | Value |
---|---|
--opc-nav-height | 60px |
--opc-nav-width | 100% |
--opc-nav-position-top | 0 |
--opc-nav-position-left | 0 |
--opc-nav-transition--defaul | 120ms ease-in-out |
--opc-nav-menu__spacing-size | 24px |
--opc-nav-menu__link-color | #151515 |
--opc-nav-container__z-index | 9 |
--opc-nav-btn__padding | 16px |
--opc-nav-display | block |
--opc-nav-btn__hover-color | #316dc11a |
--opc-nav-link__hover-color | #0066cc |
CSS Variable name | Value |
---|---|
--opc-nav-search-bg | #f3f3f3 |
--opc-nav-search__padding | 12px 17px |
--opc-nav-search__border-radius | 8px |
npm install
npm install --save @one-platform/opc-nav
import '@one-platform/opc-nav/dist/opc-nav';
<opc-nav> </opc-nav>
CUSTOM_ELEMENTS_SCHEMA
and import the componentimport { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@one-platform/opc-nav/dist/opc-nav';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
<opc-nav> </opc-nav>
import '@one-platform/opc-nav/dist/opc-nav';
<opc-nav> </opc-nav>
npm run dev opc-nav
npm run build opc-nav
npm run test
FAQs
opc-nav is a nav bar component developed using lit elements for Red Hat One Platform.
The npm package @one-platform/opc-nav receives a total of 46 weekly downloads. As such, @one-platform/opc-nav popularity was classified as not popular.
We found that @one-platform/opc-nav demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.