This commit is contained in:
Benedek László 2024-05-11 15:41:29 +02:00
parent 9bd92d048d
commit 628af48e47
8 changed files with 27 additions and 12 deletions

8
src/app/at.pipe.spec.ts Normal file
View File

@ -0,0 +1,8 @@
import { AtPipe } from './at.pipe';
describe('AtPipe', () => {
it('create an instance', () => {
const pipe = new AtPipe();
expect(pipe).toBeTruthy();
});
});

13
src/app/at.pipe.ts Normal file
View File

@ -0,0 +1,13 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'at',
standalone: true
})
export class AtPipe implements PipeTransform {
transform(value: unknown, ...args: unknown[]): string {
return '@'+value;
}
}

View File

@ -1,7 +1,7 @@
<div class="user-container outline"> <div class="user-container outline">
<div [routerLink]="'/user/'+user?.username"> <div [routerLink]="'/user/'+user?.username">
<!-- <img [src]="user?.picture" class="outline"> --> <!-- <img [src]="user?.picture" class="outline"> -->
<span>{{user?.username}}</span> <span>{{user?.username|at}}</span>
</div> </div>
<!-- <span [classList]="user?.followed ? 'follow followed' : 'follow'"></span> --> <!-- <span [classList]="user?.followed ? 'follow followed' : 'follow'"></span> -->
</div> </div>

View File

@ -21,10 +21,6 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
} }
span::before {
content: '@';
}
} }
.follow { .follow {

View File

@ -1,13 +1,14 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { User } from '../../../../model/User'; import { User } from '../../../../model/User';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { AtPipe } from '../../../at.pipe';
@Component({ @Component({
selector: 'app-large-user', selector: 'app-large-user',
standalone: true, standalone: true,
templateUrl: './large-user.component.html', templateUrl: './large-user.component.html',
styleUrl: './large-user.component.scss', styleUrl: './large-user.component.scss',
imports: [RouterModule] imports: [RouterModule,AtPipe]
}) })
export class LargeUserComponent { export class LargeUserComponent {
@Input() user: User | undefined; @Input() user: User | undefined;

View File

@ -1,4 +1,4 @@
<div [routerLink]="'/user/'+user?.username"> <div [routerLink]="'/user/'+user?.username">
<!-- <img [src]="user?.picture" class="outline"> --> <!-- <img [src]="user?.picture" class="outline"> -->
<span>{{user?.username}}</span> <span>{{user?.username|at}}</span>
</div> </div>

View File

@ -15,8 +15,4 @@ span {
margin: 20px auto; margin: 20px auto;
padding-left: 10px; padding-left: 10px;
transform: translateY(-60%); transform: translateY(-60%);
}
span::before {
content: '@';
} }

View File

@ -1,11 +1,12 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { User } from '../../../../model/User'; import { User } from '../../../../model/User';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { AtPipe } from '../../../at.pipe';
@Component({ @Component({
selector: 'app-small-user', selector: 'app-small-user',
standalone: true, standalone: true,
imports: [RouterModule], imports: [RouterModule,AtPipe],
templateUrl: './small-user.component.html', templateUrl: './small-user.component.html',
styleUrl: './small-user.component.scss' styleUrl: './small-user.component.scss'
}) })