at pipe
This commit is contained in:
parent
9bd92d048d
commit
628af48e47
8
src/app/at.pipe.spec.ts
Normal file
8
src/app/at.pipe.spec.ts
Normal 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
13
src/app/at.pipe.ts
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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>
|
@ -21,10 +21,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
span::before {
|
|
||||||
content: '@';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.follow {
|
.follow {
|
||||||
|
@ -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;
|
||||||
|
@ -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>
|
@ -16,7 +16,3 @@ span {
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
transform: translateY(-60%);
|
transform: translateY(-60%);
|
||||||
}
|
}
|
||||||
|
|
||||||
span::before {
|
|
||||||
content: '@';
|
|
||||||
}
|
|
@ -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'
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user