Skip to content

Commit 7335c39

Browse files
authored
Additions/55 back button navigation (tomalaforge#1016)
feat: new angular back button navigation challenge
1 parent d05c279 commit 7335c39

35 files changed

+493
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If you would like to propose a challenge, this project is open source, so feel f
2424
2525
## Challenges
2626

27-
Check [all 54 challenges](https://angular-challenges.vercel.app/)
27+
Check [all 55 challenges](https://angular-challenges.vercel.app/)
2828

2929
## Contributors ✨
3030

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"extends": ["../../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": [
8+
"plugin:@nx/angular",
9+
"plugin:@angular-eslint/template/process-inline-templates"
10+
],
11+
"rules": {
12+
"@angular-eslint/directive-selector": [
13+
"error",
14+
{
15+
"type": "attribute",
16+
"prefix": "app",
17+
"style": "camelCase"
18+
}
19+
],
20+
"@angular-eslint/component-selector": [
21+
"error",
22+
{
23+
"type": "element",
24+
"prefix": "app",
25+
"style": "kebab-case"
26+
}
27+
]
28+
}
29+
},
30+
{
31+
"files": ["*.html"],
32+
"extends": ["plugin:@nx/angular-template"],
33+
"rules": {}
34+
}
35+
]
36+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Back-Button-Navigation
2+
3+
> author: ioannis-tsironis
4+
5+
### Run Application
6+
7+
```bash
8+
npx nx serve angular-back-button-navigation
9+
```
10+
11+
### Documentation and Instruction
12+
13+
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/55-back-button-navigation/).
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'angular-back-button-navigation',
4+
preset: '../../../jest.preset.js',
5+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6+
coverageDirectory: '../../../coverage/apps/angular/55-back-button-navigation',
7+
transform: {
8+
'^.+\\.(ts|mjs|js|html)$': [
9+
'jest-preset-angular',
10+
{
11+
tsconfig: '<rootDir>/tsconfig.spec.json',
12+
stringifyContentPathRegex: '\\.(html|svg)$',
13+
},
14+
],
15+
},
16+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17+
snapshotSerializers: [
18+
'jest-preset-angular/build/serializers/no-ng-attributes',
19+
'jest-preset-angular/build/serializers/ng-snapshot',
20+
'jest-preset-angular/build/serializers/html-comment',
21+
],
22+
};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"name": "angular-back-button-navigation",
3+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"prefix": "app",
6+
"sourceRoot": "apps/angular/55-back-button-navigation/src",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@angular-devkit/build-angular:application",
11+
"outputs": ["{options.outputPath}"],
12+
"options": {
13+
"outputPath": "dist/apps/angular/55-back-button-navigation",
14+
"index": "apps/angular/55-back-button-navigation/src/index.html",
15+
"browser": "apps/angular/55-back-button-navigation/src/main.ts",
16+
"polyfills": ["zone.js"],
17+
"tsConfig": "apps/angular/55-back-button-navigation/tsconfig.app.json",
18+
"inlineStyleLanguage": "scss",
19+
"assets": [
20+
{
21+
"glob": "**/*",
22+
"input": "apps/angular/55-back-button-navigation/public"
23+
}
24+
],
25+
"styles": [
26+
"apps/angular/55-back-button-navigation/src/styles.scss",
27+
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
28+
],
29+
"scripts": []
30+
},
31+
"configurations": {
32+
"production": {
33+
"budgets": [
34+
{
35+
"type": "initial",
36+
"maximumWarning": "500kb",
37+
"maximumError": "1mb"
38+
},
39+
{
40+
"type": "anyComponentStyle",
41+
"maximumWarning": "2kb",
42+
"maximumError": "4kb"
43+
}
44+
],
45+
"outputHashing": "all"
46+
},
47+
"development": {
48+
"optimization": false,
49+
"extractLicenses": false,
50+
"sourceMap": true
51+
}
52+
},
53+
"defaultConfiguration": "production"
54+
},
55+
"serve": {
56+
"executor": "@angular-devkit/build-angular:dev-server",
57+
"configurations": {
58+
"production": {
59+
"buildTarget": "angular-back-button-navigation:build:production"
60+
},
61+
"development": {
62+
"buildTarget": "angular-back-button-navigation:build:development"
63+
}
64+
},
65+
"defaultConfiguration": "development"
66+
},
67+
"extract-i18n": {
68+
"executor": "@angular-devkit/build-angular:extract-i18n",
69+
"options": {
70+
"buildTarget": "angular-back-button-navigation:build"
71+
}
72+
},
73+
"lint": {
74+
"executor": "@nx/eslint:lint"
75+
},
76+
"test": {
77+
"executor": "@nx/jest:jest",
78+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
79+
"options": {
80+
"jestConfig": "apps/angular/55-back-button-navigation/jest.config.ts"
81+
}
82+
}
83+
}
84+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<router-outlet></router-outlet>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
import { RouterLink, RouterOutlet } from '@angular/router';
3+
4+
@Component({
5+
standalone: true,
6+
imports: [RouterOutlet, RouterLink],
7+
selector: 'app-root',
8+
templateUrl: './app.component.html',
9+
})
10+
export class AppComponent {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { APP_ROUTES } from './app.routes';
4+
5+
export const appConfig: ApplicationConfig = {
6+
providers: [
7+
provideZoneChangeDetection({ eventCoalescing: true }),
8+
provideRouter(APP_ROUTES),
9+
],
10+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Routes } from '@angular/router';
2+
import { HomeComponent } from './home/home.component';
3+
import { SensitiveActionComponent } from './sensitive-action/sensitive-action.component';
4+
import { SimpleActionComponent } from './simple-action/simple-action.component';
5+
6+
export const APP_ROUTES: Routes = [
7+
{
8+
path: '',
9+
pathMatch: 'full',
10+
redirectTo: 'home',
11+
},
12+
{
13+
path: 'home',
14+
component: HomeComponent,
15+
},
16+
{
17+
path: 'simple-action',
18+
component: SimpleActionComponent,
19+
},
20+
{
21+
path: 'sensitive-action',
22+
component: SensitiveActionComponent,
23+
},
24+
];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h2 mat-dialog-title>Delete file</h2>
2+
<mat-dialog-content>Would you like to delete cat.jpeg?</mat-dialog-content>
3+
<mat-dialog-actions>
4+
<button mat-button mat-dialog-close>No</button>
5+
<button mat-button mat-dialog-close cdkFocusInitial>Ok</button>
6+
</mat-dialog-actions>

0 commit comments

Comments
 (0)