mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 07:50:12 +01:00
adding main and aria label to controls
This commit is contained in:
parent
1fb348c832
commit
46e67b704f
8 changed files with 44 additions and 5 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
<nb-actions size="small">
|
<nb-actions size="small">
|
||||||
|
|
||||||
<nb-action class="control-item">
|
<nb-action class="control-item">
|
||||||
<nb-search type="rotate-layout"></nb-search>
|
<nb-search ngxSearchAriaLabel type="rotate-layout"></nb-search>
|
||||||
</nb-action>
|
</nb-action>
|
||||||
<nb-action class="control-item" icon="email-outline"></nb-action>
|
<nb-action class="control-item" icon="email-outline"></nb-action>
|
||||||
<nb-action class="control-item" icon="bell-outline"></nb-action>
|
<nb-action class="control-item" icon="bell-outline"></nb-action>
|
||||||
|
|
|
||||||
22
src/app/@theme/components/search-aria-label.directive.ts
Normal file
22
src/app/@theme/components/search-aria-label.directive.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { Directive, ElementRef, AfterViewInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[ngxSearchAriaLabel]',
|
||||||
|
})
|
||||||
|
export class SearchAriaLabelDirective implements AfterViewInit {
|
||||||
|
constructor(private el: ElementRef) {}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
const nativeElement: HTMLElement = this.el.nativeElement;
|
||||||
|
|
||||||
|
// Add aria-labels to internal buttons
|
||||||
|
const buttons = nativeElement.querySelectorAll('button');
|
||||||
|
buttons.forEach((btn, i) => {
|
||||||
|
if (btn && !btn.hasAttribute('aria-label')) {
|
||||||
|
if (btn.classList.contains('start-search')) {
|
||||||
|
btn.setAttribute('aria-label', 'Search');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,9 @@ import { Component } from '@angular/core';
|
||||||
</nb-sidebar>
|
</nb-sidebar>
|
||||||
|
|
||||||
<nb-layout-column>
|
<nb-layout-column>
|
||||||
<ng-content select="router-outlet"></ng-content>
|
<main>
|
||||||
|
<ng-content select="router-outlet"></ng-content>
|
||||||
|
</main>
|
||||||
</nb-layout-column>
|
</nb-layout-column>
|
||||||
|
|
||||||
<nb-layout-footer fixed>
|
<nb-layout-footer fixed>
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import { DEFAULT_THEME } from './styles/theme.default';
|
||||||
import { COSMIC_THEME } from './styles/theme.cosmic';
|
import { COSMIC_THEME } from './styles/theme.cosmic';
|
||||||
import { CORPORATE_THEME } from './styles/theme.corporate';
|
import { CORPORATE_THEME } from './styles/theme.corporate';
|
||||||
import { DARK_THEME } from './styles/theme.dark';
|
import { DARK_THEME } from './styles/theme.dark';
|
||||||
|
import {SearchAriaLabelDirective} from './components/search-aria-label.directive';
|
||||||
|
|
||||||
const NB_MODULES = [
|
const NB_MODULES = [
|
||||||
NbLayoutModule,
|
NbLayoutModule,
|
||||||
|
|
@ -61,6 +62,7 @@ const COMPONENTS = [
|
||||||
OneColumnLayoutComponent,
|
OneColumnLayoutComponent,
|
||||||
ThreeColumnsLayoutComponent,
|
ThreeColumnsLayoutComponent,
|
||||||
TwoColumnsLayoutComponent,
|
TwoColumnsLayoutComponent,
|
||||||
|
SearchAriaLabelDirective,
|
||||||
];
|
];
|
||||||
const PIPES = [
|
const PIPES = [
|
||||||
CapitalizePipe,
|
CapitalizePipe,
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import {
|
||||||
NbLogoutComponent,
|
NbLogoutComponent,
|
||||||
NbRegisterComponent,
|
NbRegisterComponent,
|
||||||
NbRequestPasswordComponent,
|
NbRequestPasswordComponent,
|
||||||
NbResetPasswordComponent,
|
|
||||||
} from '@nebular/auth';
|
} from '@nebular/auth';
|
||||||
|
import {CustomResetPasswordComponent} from './pages/auth/reset-password/custom-reset-password.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
|
|
@ -41,7 +41,7 @@ export const routes: Routes = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'reset-password',
|
path: 'reset-password',
|
||||||
component: NbResetPasswordComponent,
|
component: CustomResetPasswordComponent,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,10 @@ import {
|
||||||
NbToastrModule,
|
NbToastrModule,
|
||||||
NbWindowModule,
|
NbWindowModule,
|
||||||
} from '@nebular/theme';
|
} from '@nebular/theme';
|
||||||
|
import {CustomResetPasswordComponent} from './pages/auth/reset-password/custom-reset-password.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent, CustomResetPasswordComponent],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<main>
|
||||||
|
<nb-reset-password-page></nb-reset-password-page>
|
||||||
|
</main>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
import {NbResetPasswordComponent} from '@nebular/auth';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: './custom-reset-password.component.html',
|
||||||
|
})
|
||||||
|
export class CustomResetPasswordComponent extends NbResetPasswordComponent {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue