feat(): merge challenge 57

This commit is contained in:
thomas
2025-02-28 11:51:26 +01:00
parent b8d10b940c
commit 3f6f6def3d
24 changed files with 309 additions and 17 deletions

View File

@@ -0,0 +1,16 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { CardComponent } from './card.component';
@Component({
imports: [CardComponent],
selector: 'app-root',
template: `
<app-card title="Titre 1" message="Message1" />
<app-card title="Titre 2" />
`,
host: {
class: 'p-4 block flex flex-col gap-1',
},
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {}

View File

@@ -0,0 +1,5 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
};

View File

@@ -0,0 +1,22 @@
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
@Component({
selector: 'app-card',
imports: [],
template: `
<div>{{ title() }}</div>
@if (message()) {
<div>{{ message() }}</div>
} @else {
<div>Aucun message</div>
}
`,
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'p-4 border border-grey rounded-sm flex flex-col w-[200px]',
},
})
export class CardComponent {
title = input.required<string>();
message = input<string | undefined>(undefined);
}

View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>angular-content-projection-default</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<app-root></app-root>
</body>
</html>

View File

@@ -0,0 +1,7 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';
bootstrapApplication(AppComponent, appConfig).catch((err) =>
console.error(err),
);

View File

@@ -0,0 +1,5 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/* You can add global styles to this file, and also import other style files */