"build": {
...,
"styles": [
"./node_modules/@catrx/ui/prebuilt-theme/prebuilt-theme.scss",
"src/styles.scss"
]
}
:root,
main {
--c-menu: #1E88E5;
--c-menu-hover: #1976D2;
--c-menu-active: #1565C0;
--bg-menu: #E3F2FD;
--bg-menu-hover: #BBDEFB;
--bg-menu-active: #90CAF9;
}
2. Configurando environment
import { CatEnvironmentInterface } from "@catrx/ui/common";
export const environment: CatEnvironmentInterface = {
production: false,
storageTokenName: 'cat-crud-example-token'
};
3. Importando módulo principal
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CatUiModule } from '@catrx/ui';
import { environment } from '../environments/environment';
@NgModule({
declarations: [AppComponent],
imports: [
CatUiModule.forRoot(environment, {
xlsxConfig: {
headerBackgroundColor: '#212121',
headerFontColor: '#f1f1f1',
normalizeHeader: true
}
}),
AppRoutingModule
],
bootstrap: [AppComponent],
})
export class AppModule {}
import { Injectable } from '@angular/core';
import { AppConfigMenu, CatAppDecodedToken } from '@catrx/ui';
import { Observable } from 'rxjs/internal/Observable';
@Injectable({ providedIn: 'any' })
export class AppService {
constructor() {}
public getMenu(decodedToken: CatAppDecodedToken) {
return new Observable<AppConfigMenu>((observe) => {
observe.next({
modules: [],
});
});
}
}
5. Criando LoginComponent
import { Component } from '@angular/core';
@Component({
template: ``,
styles: [``],
standalone: true,
imports: [],
})
export class LoginComponent {
}
6. Configurando AppComponent
import { Component } from '@angular/core';
import { CatAppService } from '@catrx/ui';
import { LoginComponent } from './login.component';
import { AppService } from './app.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
appConfig = this.catappService
.build('PetShop', {
autoAuth: true,
jwt: {
loginComponent: LoginComponent,
},
onAuth: (decodedToken) => this.appService.getMenu(decodedToken),
}, {menuStartState: 'closed', disableCollapseMenuButton: true})
.setLogotype({
default: '../assets/logotype.svg',
negative: '../assets/logotype-negative.svg',
})
.enableDarkMode()
.generate();
constructor(
private catappService: CatAppService,
private appService: AppService
) {}
}
<cat-app-container [config]="appConfig">
<ng-container router-container>
<router-outlet></router-outlet>
</ng-container>
</cat-app-container>