feat: counter
This commit is contained in:
1
src/app/components/counter/counter.html
Normal file
1
src/app/components/counter/counter.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<p class="total-elements"><span>{{count()}}</span> {{item()|upperfirst}}</p>
|
||||||
17
src/app/components/counter/counter.scss
Normal file
17
src/app/components/counter/counter.scss
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
:host {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-elements {
|
||||||
|
font-family: var(--secondaryFont);
|
||||||
|
margin: 2rem 0;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--primary);
|
||||||
|
font-size: 2rem;
|
||||||
|
|
||||||
|
& span {
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/app/components/counter/counter.spec.ts
Normal file
24
src/app/components/counter/counter.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Counter } from './counter';
|
||||||
|
import { UpperfirstPipe } from '../../pipes/upperfirst-pipe';
|
||||||
|
|
||||||
|
describe('Counter', () => {
|
||||||
|
let component: Counter;
|
||||||
|
let fixture: ComponentFixture<Counter>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Counter, UpperfirstPipe]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Counter);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
13
src/app/components/counter/counter.ts
Normal file
13
src/app/components/counter/counter.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { Component, input } from '@angular/core';
|
||||||
|
import { UpperfirstPipe } from "../../pipes/upperfirst-pipe";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-counter',
|
||||||
|
imports: [UpperfirstPipe],
|
||||||
|
templateUrl: './counter.html',
|
||||||
|
styleUrl: './counter.scss',
|
||||||
|
})
|
||||||
|
export class Counter {
|
||||||
|
item = input('');
|
||||||
|
count = input(0);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user