Skip to content

Commit 77ecc5a

Browse files
feat: (issue-23) create reusable single input component
wip: fix linter errors style(): adjust input width style: adjust input color and padding
1 parent 950dca3 commit 77ecc5a

File tree

12 files changed

+138
-18
lines changed

12 files changed

+138
-18
lines changed

package-lock.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"private": true,
3131
"dependencies": {
3232
"@angular/animations": "^19.0.0",
33+
"@angular/cdk": "^19.1.5",
3334
"@angular/common": "^19.0.0",
3435
"@angular/compiler": "^19.0.0",
3536
"@angular/core": "^19.0.0",
@@ -39,7 +40,8 @@
3940
"@angular/router": "^19.0.0",
4041
"@ngrx/store": "^19.0.1",
4142
"@primeng/themes": "^19.0.6",
42-
"primeng": "^19.0.6",
43+
"primeicons": "^7.0.0",
44+
"primeng": "^19.0.8",
4345
"rxjs": "~7.8.0",
4446
"tslib": "^2.3.0",
4547
"zone.js": "~0.15.0"

public/LogoALAsso.png

-1.87 KB
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p-floatlabel [variant]="variant">
2+
<input pInputText [id]="'input_' + (label | lowercase)" [(ngModel)]="value" [type]="type" [disabled]="disabled" autocomplete="off" />
3+
<label [for]="'input_' + (label | lowercase)">{{ label }}</label>
4+
</p-floatlabel>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
p-floatlabel {
2+
input {
3+
width: 100%;
4+
font-size: 16px;
5+
background-color: var(--background-color-light);
6+
border: var(--grey-border);
7+
border-radius: 8px;
8+
transition: border-color 0.3s ease-in-out;
9+
color: black;
10+
11+
&:focus,
12+
&:hover,
13+
&:active {
14+
border-color: var(--primary-light-color) !important;
15+
outline: none;
16+
~ label {
17+
color: var(--primary-light-color);
18+
}
19+
}
20+
21+
label {
22+
transition: all 0.3s ease-in-out;
23+
color: var(--primary-light-color);
24+
}
25+
}
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { InputFieldComponent } from './input-field.component';
4+
5+
describe('InputFieldComponent', () => {
6+
let component: InputFieldComponent;
7+
let fixture: ComponentFixture<InputFieldComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [InputFieldComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(InputFieldComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Component, Input } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { InputTextModule } from 'primeng/inputtext';
4+
import { FloatLabelModule } from 'primeng/floatlabel';
5+
import { FormsModule } from '@angular/forms';
6+
7+
@Component({
8+
selector: 'app-input-field',
9+
standalone: true,
10+
imports: [CommonModule, InputTextModule, FloatLabelModule, FormsModule],
11+
templateUrl: './input-field.component.html',
12+
styleUrls: ['./input-field.component.scss'],
13+
})
14+
export class InputFieldComponent {
15+
@Input() label: string = '';
16+
@Input() type: string = 'text';
17+
@Input() disabled: boolean = false;
18+
@Input() variant: 'in' | 'on' = 'in';
19+
value: string = '';
20+
}

src/app/features/activity/pages/activities-home/activities-home.component.html

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<div class="activities-home">
2-
<div class="search-activities">
3-
<!--TODO: rajouter ici composant qui regroupe les input de recherche pour la page activities-->
2+
<div class="activities-home__header">
3+
<h3>Demo Input Single</h3>
4+
<div class="activities-home__header__inputs">
5+
<app-input-field label="Nom"></app-input-field>
6+
<app-input-field label="Prénom"></app-input-field>
7+
</div>
48
</div>
59

6-
<div class="cards-and-map">
7-
<div class="cards-activities" [ngClass]="chosenNavigation !== 'Liste' ? 'hidden' : ''">
8-
@for (activity of activities$ | async; track activity.id) {
10+
<div class="activities-home__list">
11+
<div class="search-activities">
12+
<!--TODO: rajouter ici composant qui regroupe les input de recherche pour la page activities-->
13+
</div>
14+
15+
<div class="cards-and-map">
16+
<div class="cards-activities" [ngClass]="chosenNavigation !== 'Liste' ? 'hidden' : ''">
17+
@for (activity of activities$ | async; track activity.id) {
918
<app-activity-card [activity]="activity"></app-activity-card>
10-
}
19+
}
20+
</div>
1121
</div>
1222
<div class="map-activities" [ngClass]="chosenNavigation !== 'Carte' ? 'hidden' : ''">
1323
<!--TODO: rajouter ici composant map pour la page activities-->

src/app/features/activity/pages/activities-home/activities-home.component.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,34 @@
5151
transform: translateX(-50%);
5252
}
5353
}
54+
55+
&__header {
56+
display: flex;
57+
flex-direction: column;
58+
text-align: center;
59+
margin-bottom: 50px;
60+
h3 {
61+
font-size: 1.5rem;
62+
color: var(--primary-light-color);
63+
}
64+
65+
&__inputs {
66+
display: flex;
67+
flex-direction: column;
68+
align-items: center;
69+
gap: 1rem;
70+
71+
.input-field {
72+
width: 200px;
73+
}
74+
}
75+
}
76+
77+
&__list {
78+
display: flex;
79+
flex-wrap: wrap;
80+
justify-content: space-around;
81+
gap: 1rem;
82+
padding: 1rem;
83+
}
5484
}

src/app/features/activity/pages/activities-home/activities-home.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { Activity } from '../../models/activity.model';
55
import { Observable } from 'rxjs';
66
import { AsyncPipe, NgClass } from '@angular/common';
77
import { ToggleMenuComponent } from '../../../../common/components/toggle-menu/toggle-menu.component';
8+
import { InputFieldComponent } from '../../../../common/components/input-field/input-field.component';
89

910
@Component({
1011
selector: 'app-activities-home',
11-
imports: [ActivityCardComponent, AsyncPipe, ToggleMenuComponent, NgClass],
12+
imports: [ActivityCardComponent, AsyncPipe, ToggleMenuComponent, NgClass, InputFieldComponent],
1213
templateUrl: './activities-home.component.html',
1314
styleUrl: './activities-home.component.scss',
1415
standalone: true,

0 commit comments

Comments
 (0)