# Estrutura

Com o [projeto criado](/guias/criando-uma-aplicacao-de-crud/criando-projeto.md), abra-o com seu editor favorito para integrar o Cat UI ao projeto.

### 1. Aplicando Tema

Inclua o arquivo de estilos em seu projeto pelo arquivo angular.json

{% code title="angular.json" %}

```json
"build": {
  ...,
  "styles": [
    "./node_modules/@catrx/ui/prebuilt-theme/prebuilt-theme.scss",
    "src/styles.scss"
  ]
}
```

{% endcode %}

{% code title="styles.scss" lineNumbers="true" %}

```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;
}
```

{% endcode %}

{% hint style="info" %}
Caso queira ver mais sobre estilização e variáveis de cores, clique [aqui](/comece-por-aqui/2.-aplicando-tema.md).
{% endhint %}

### 2. Configurando environment

{% code title="environment.ts" lineNumbers="true" %}

```typescript
import { CatEnvironmentInterface } from "@catrx/ui/common";

export const environment: CatEnvironmentInterface = {
  production: false,
  storageTokenName: 'cat-crud-example-token'
};
```

{% endcode %}

### **3. Importando módulo principal**

{% code title="app.module.ts" lineNumbers="true" %}

```typescript
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 {}
```

{% endcode %}

### 4. Criando AppService

{% code title="app.service.ts" lineNumbers="true" %}

```typescript
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: [],
      });
    });
  }
}
```

{% endcode %}

### 5. Criando LoginComponent

{% code title="login.component.ts" lineNumbers="true" %}

```typescript
import { Component } from '@angular/core';

@Component({
  template: ``,
  styles: [``],
  standalone: true,
  imports: [],
})
export class LoginComponent {
}
```

{% endcode %}

### 6. Configurando AppComponent

{% code title="app.component.ts" lineNumbers="true" %}

```typescript
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
  ) {}
}
```

{% endcode %}

{% code title="app.component.html" %}

```html
<cat-app-container [config]="appConfig">
  <ng-container router-container>
    <router-outlet></router-outlet>
  </ng-container>
</cat-app-container>
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.catui.igordrangel.com.br/guias/criando-uma-aplicacao-de-crud/estrutura.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
