Skip to content

Commit ee62aaa

Browse files
committed
separated common animation
1 parent 9f7be75 commit ee62aaa

File tree

5 files changed

+21
-35
lines changed

5 files changed

+21
-35
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { animate, style, transition, trigger } from "@angular/animations";
2+
3+
export const valueChangeAnim = trigger('valueChangeAnim', [
4+
transition('* <=> *', [
5+
animate('0.07s ease-out', style({ "border-color": "limegreen" })),
6+
animate('0.07s ease-in', style({ "border-color": "var(--bs-border-color)" }))
7+
]),
8+
]);

Frontend/src/app/cs2ts/cs2ts.component.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,15 @@ import { AfterContentInit, Component } from '@angular/core';
22
import { FormsModule } from '@angular/forms';
33
import { debounceTime, Subject, takeLast, tap } from 'rxjs';
44
import { CodeAreaComponent } from '../code-area/code-area.component';
5-
import { animate, style, transition, trigger } from '@angular/animations';
65
import { Meta } from '@angular/platform-browser';
6+
import { valueChangeAnim } from '../../animations/common-animations';
77

88
@Component({
99
selector: 'app-cs2ts',
1010
standalone: true,
1111
imports: [FormsModule, CodeAreaComponent],
1212
templateUrl: './cs2ts.component.html',
13-
animations: [
14-
trigger('valueChangeAnim', [
15-
transition('* <=> *', [
16-
animate('0.07s ease-out', style({ "border-color": "limegreen" })),
17-
animate('0.07s ease-in', style({ "border-color": "var(--bs-border-color)" }))
18-
]),
19-
])
20-
]
13+
animations: [valueChangeAnim]
2114
})
2215
export class Cs2tsComponent implements AfterContentInit {
2316
protected csCode: string = `public class a : b {

Frontend/src/app/md2html/md2html.component.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,16 @@ import { AfterContentInit, Component } from '@angular/core';
22
import { FormsModule } from '@angular/forms';
33
import { debounceTime, Subject, takeLast, tap } from 'rxjs';
44
import { CodeAreaComponent } from '../code-area/code-area.component';
5-
import { animate, style, transition, trigger } from '@angular/animations';
65
import { Meta } from '@angular/platform-browser';
76
import { parse } from 'marked';
7+
import { valueChangeAnim } from '../../animations/common-animations';
88

99
@Component({
1010
selector: 'app-md2html',
1111
standalone: true,
1212
imports: [FormsModule, CodeAreaComponent],
1313
templateUrl: './md2html.component.html',
14-
animations: [
15-
trigger('valueChangeAnim', [
16-
transition('* <=> *', [
17-
animate('0.07s ease-out', style({ "border-color": "limegreen" })),
18-
animate('0.07s ease-in', style({ "border-color": "var(--bs-border-color)" }))
19-
]),
20-
])
21-
]
14+
animations: [valueChangeAnim]
2215
})
2316
export class Md2htmlComponent implements AfterContentInit {
2417
protected mdCode: string = `# Hello world

Frontend/src/app/mssql-scaffolder/mssql-scaffolder.component.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,22 @@ import { MssqlScaffolderService } from './mssql-scaffolder.service';
99
import { Meta } from '@angular/platform-browser';
1010
import { GetColumnsResponse, GetSPParametersResponse, GetSPReturnColumnsResponse } from './mssql-scaffolder.model';
1111
import { RouterLink } from '@angular/router';
12+
import { valueChangeAnim } from '../../animations/common-animations';
1213

1314
@Component({
1415
selector: 'app-mssql-scaffolder',
1516
standalone: true,
1617
imports: [FormsModule, ReactiveFormsModule, CodeAreaComponent, RouterLink],
1718
templateUrl: './mssql-scaffolder.component.html',
1819
animations: [
20+
valueChangeAnim,
1921
trigger('connection', [
2022
state("0", style({ "border-width": "3px", "border-color": "var(--bs-border-color)" })),
2123
state("1", style({ "border-width": "3px", "border-color": "var(--bs-warning)" })),
2224
state("2", style({ "border-width": "3px", "border-color": "limegreen" })),
2325
transition('* <=> *', [
2426
animate('0.1s ease-in-out'),
2527
]),
26-
]),
27-
trigger('valueChangeAnim', [
28-
transition('* <=> *', [
29-
animate('0.07s ease-out', style({ "border-color": "limegreen" })),
30-
animate('0.07s ease-in', style({ "border-color": "var(--bs-border-color)" }))
31-
]),
3228
])
3329
]
3430
})
@@ -215,18 +211,18 @@ ${res.map((p) => `\tpublic ${MssqlScaffolderComponent.convertDataType(p.DataType
215211
ps = ps as GetSPParametersResponse[];
216212
this.scaffolder.getSPReturnColumns(this.connectionID, sc.database, sc.schema, sc.sp).subscribe(rs => {
217213
rs = rs as GetSPReturnColumnsResponse[];
218-
214+
219215
const psc = ps.map((p) => `\tpublic ${MssqlScaffolderComponent.convertDataType(p.Type)}${p.Nullable ? '?' : ''} ${p.Parameter_name} { get; set; }`);
220216
const rsc = rs.map((p) => `\tpublic ${MssqlScaffolderComponent.convertDataType(p.system_type_name)}${p.Nullable ? '?' : ''} ${p.column} { get; set; }`);
221217

222218
this.csCode =
223-
`${psc.length > 0 ? `public class ${sc.sp}Params {`:'' }
219+
`${psc.length > 0 ? `public class ${sc.sp}Params {` : ''}
224220
${psc.join("\n")}
225-
${psc.length > 0 ? '}':'' }
221+
${psc.length > 0 ? '}' : ''}
226222
227-
${rsc.length>0? `public class ${sc.sp}Result {`:'' }
223+
${rsc.length > 0 ? `public class ${sc.sp}Result {` : ''}
228224
${rsc.join("\n")}
229-
${rsc.length > 0 ? '}':'' }`;
225+
${rsc.length > 0 ? '}' : ''}`;
230226
this.codeFlip = !this.codeFlip;
231227
});
232228
});

Frontend/src/app/serialized-tool/serialized-tool.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@ import { Meta } from '@angular/platform-browser';
77
import { parse as tomlParse, stringify as tomlStringify } from 'smol-toml';
88
import { XMLParser as xmlParse, XMLBuilder as xmlStringify } from 'fast-xml-parser';
99
import YAML from 'yamljs';
10+
import { valueChangeAnim } from '../../animations/common-animations';
1011

1112
@Component({
1213
selector: 'app-serialized-tool',
1314
standalone: true,
1415
imports: [FormsModule, CodeAreaComponent],
1516
templateUrl: './serialized-tool.component.html',
1617
animations: [
17-
trigger('valueChangeAnim', [
18-
transition('* <=> *', [
19-
animate('0.07s ease-out', style({ "border-color": "limegreen" })),
20-
animate('0.07s ease-in', style({ "border-color": "var(--bs-border-color)" }))
21-
]),
22-
]),
18+
valueChangeAnim,
2319
trigger('hasError', [
2420
state('true', style({ "border-color": "red" })),
2521
state('false', style({ "border-color": "var(--bs-border-color)" })),

0 commit comments

Comments
 (0)