jehoelkh
This commit is contained in:
37
src/app/components/book-card/book-card.css
Normal file
37
src/app/components/book-card/book-card.css
Normal file
@@ -0,0 +1,37 @@
|
||||
.book-card-container {
|
||||
background: #f5f5f5; /* fond clair */
|
||||
padding: 20px; /* espace autour de la carte */
|
||||
border-radius: 12px; /* coins arrondis */
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* ombre douce */
|
||||
transition: transform 0.2s, box-shadow 0.2s; /* animation au survol */
|
||||
width: 300px;
|
||||
margin: 10px auto; /* centre la carte dans le parent */
|
||||
}
|
||||
|
||||
.book-card-container:hover {
|
||||
transform: translateY(-5px); /* petit effet de “lift” au survol */
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* ombre plus prononcée */
|
||||
}
|
||||
|
||||
.book-card-container nz-card {
|
||||
border-radius: 12px; /* coins arrondis de la carte NZ */
|
||||
background-color: #ffffff; /* fond blanc */
|
||||
padding: 16px; /* espace intérieur */
|
||||
}
|
||||
|
||||
.book-card-container p {
|
||||
margin: 5px 0; /* espace vertical entre les paragraphes */
|
||||
color: #333; /* texte gris foncé */
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.book-card-container a {
|
||||
color: #1890ff; /* bleu Ant Design */
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.book-card-container a:hover {
|
||||
text-decoration: underline; /* souligne au survol */
|
||||
}
|
||||
13
src/app/components/book-card/book-card.html
Normal file
13
src/app/components/book-card/book-card.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="book-card-container">
|
||||
<nz-card
|
||||
[nzBordered]="false"
|
||||
nzTitle="{{ bookInfo().title }}"
|
||||
[nzExtra]="extraTemplate">
|
||||
<p>{{ bookInfo().author }}</p>
|
||||
<p>{{ bookInfo().releaseYear }}</p>
|
||||
</nz-card>
|
||||
</div>
|
||||
|
||||
<ng-template #extraTemplate>
|
||||
<a>More</a>
|
||||
</ng-template>
|
||||
17
src/app/components/book-card/book-card.ts
Normal file
17
src/app/components/book-card/book-card.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Component, input} from '@angular/core'; // Importation de la fonction input() et des components
|
||||
import {BookInfo} from '../../interfaces/book.interfaces';
|
||||
import {NzCardComponent} from "ng-zorro-antd/card";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; // Interface
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-card',
|
||||
imports: [
|
||||
NzCardComponent,
|
||||
NzFlexDirective
|
||||
],
|
||||
templateUrl: './book-card.html',
|
||||
styleUrl: './book-card.css',
|
||||
})
|
||||
export class BookCard {
|
||||
bookInfo = input.required<BookInfo>();
|
||||
}
|
||||
0
src/app/components/create-modal/create-modal.css
Normal file
0
src/app/components/create-modal/create-modal.css
Normal file
13
src/app/components/create-modal/create-modal.html
Normal file
13
src/app/components/create-modal/create-modal.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<button nz-button nzType="primary" (click)="showModal()">
|
||||
<span>Ajouter un livre</span> Ajouter
|
||||
</button>
|
||||
|
||||
<nz-modal
|
||||
[(nzVisible)]="isVisible"
|
||||
nzTitle="Ajouter"
|
||||
(nzOnCancel)="handleCancel()"
|
||||
(nzOnOk)="handleOk()"
|
||||
[nzOkLoading]="isOkLoading"
|
||||
>
|
||||
<ng-container [ngComponentOutlet]="content"></ng-container>
|
||||
</nz-modal>
|
||||
32
src/app/components/create-modal/create-modal.ts
Normal file
32
src/app/components/create-modal/create-modal.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import {Component, input, Type} from '@angular/core';
|
||||
import { NzButtonModule } from 'ng-zorro-antd/button';
|
||||
import { NzModalModule } from 'ng-zorro-antd/modal';
|
||||
import {NgComponentOutlet} from "@angular/common";
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-modal',
|
||||
imports: [NzButtonModule, NzModalModule, NgComponentOutlet],
|
||||
templateUrl: 'create-modal.html',
|
||||
styleUrls: ['./create-modal.css'],
|
||||
})
|
||||
export class CreateModal {
|
||||
content = input.required<Type<any>>();
|
||||
isVisible = false;
|
||||
isOkLoading = false;
|
||||
|
||||
showModal(): void {
|
||||
this.isVisible = true;
|
||||
}
|
||||
|
||||
handleOk(): void {
|
||||
this.isOkLoading = true;
|
||||
setTimeout(() => {
|
||||
this.isVisible = false;
|
||||
this.isOkLoading = false;
|
||||
}, 3000); // 3 secondes
|
||||
}
|
||||
|
||||
handleCancel(): void {
|
||||
this.isVisible = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user