mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
Merge pull request #759 from alcaidio/feat/challenge-48
feat: create challenge 48 without solution
This commit is contained in:
@@ -24,7 +24,7 @@ If you would like to propose a challenge, this project is open source, so feel f
|
|||||||
|
|
||||||
## Challenges
|
## Challenges
|
||||||
|
|
||||||
Check [all 47 challenges](https://angular-challenges.vercel.app/)
|
Check [all 48 challenges](https://angular-challenges.vercel.app/)
|
||||||
|
|
||||||
## Contributors ✨
|
## Contributors ✨
|
||||||
|
|
||||||
|
|||||||
36
apps/forms/form-dialog-alert/.eslintrc.json
Normal file
36
apps/forms/form-dialog-alert/.eslintrc.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"extends": ["../../../.eslintrc.json"],
|
||||||
|
"ignorePatterns": ["!**/*"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts"],
|
||||||
|
"extends": [
|
||||||
|
"plugin:@nx/angular",
|
||||||
|
"plugin:@angular-eslint/template/process-inline-templates"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "attribute",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "camelCase"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.html"],
|
||||||
|
"extends": ["plugin:@nx/angular-template"],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
11
apps/forms/form-dialog-alert/README.md
Normal file
11
apps/forms/form-dialog-alert/README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Avoid losing form data
|
||||||
|
|
||||||
|
> author: [Timothy Alcaide](https://github.com/alcaidio)
|
||||||
|
|
||||||
|
### Run Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx nx serve form-dialog-alert
|
||||||
|
```
|
||||||
|
|
||||||
|
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/forms/48-form-dialog-alert/).
|
||||||
72
apps/forms/form-dialog-alert/project.json
Normal file
72
apps/forms/form-dialog-alert/project.json
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"name": "form-dialog-alert",
|
||||||
|
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"projectType": "application",
|
||||||
|
"prefix": "app",
|
||||||
|
"sourceRoot": "apps/forms/form-dialog-alert/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@angular-devkit/build-angular:application",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/apps/forms/form-dialog-alert",
|
||||||
|
"index": "apps/forms/form-dialog-alert/src/index.html",
|
||||||
|
"browser": "apps/forms/form-dialog-alert/src/main.ts",
|
||||||
|
"polyfills": ["zone.js"],
|
||||||
|
"tsConfig": "apps/forms/form-dialog-alert/tsconfig.app.json",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
"apps/forms/form-dialog-alert/src/favicon.ico",
|
||||||
|
"apps/forms/form-dialog-alert/src/assets"
|
||||||
|
],
|
||||||
|
"styles": ["apps/forms/form-dialog-alert/src/styles.scss"],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"maximumError": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"executor": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"buildTarget": "form-dialog-alert:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildTarget": "form-dialog-alert:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"buildTarget": "form-dialog-alert:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/eslint:lint"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
apps/forms/form-dialog-alert/src/app/app.component.ts
Normal file
20
apps/forms/form-dialog-alert/src/app/app.component.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { RouterOutlet } from '@angular/router';
|
||||||
|
import { NavComponent } from './ui/nav.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
standalone: true,
|
||||||
|
imports: [RouterOutlet, NavComponent],
|
||||||
|
selector: 'app-root',
|
||||||
|
template: `
|
||||||
|
<div class="h-screen bg-gray-50">
|
||||||
|
<app-nav
|
||||||
|
class="mx-auto flex w-full items-center justify-center pb-2 pt-8" />
|
||||||
|
|
||||||
|
<main class="px-4 py-16 sm:px-6 lg:px-8">
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
export class AppComponent {}
|
||||||
7
apps/forms/form-dialog-alert/src/app/app.config.ts
Normal file
7
apps/forms/form-dialog-alert/src/app/app.config.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { ApplicationConfig } from '@angular/core';
|
||||||
|
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
||||||
|
import { appRoutes } from './app.routes';
|
||||||
|
|
||||||
|
export const appConfig: ApplicationConfig = {
|
||||||
|
providers: [provideRouter(appRoutes, withComponentInputBinding())],
|
||||||
|
};
|
||||||
29
apps/forms/form-dialog-alert/src/app/app.routes.ts
Normal file
29
apps/forms/form-dialog-alert/src/app/app.routes.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Route } from '@angular/router';
|
||||||
|
import { JoinComponent } from './pages/join.component';
|
||||||
|
import { PageComponent } from './pages/page.component';
|
||||||
|
|
||||||
|
export const appRoutes: Route[] = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
redirectTo: 'form',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'form',
|
||||||
|
loadComponent: () => JoinComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'page-1',
|
||||||
|
data: {
|
||||||
|
title: 'Page 1',
|
||||||
|
},
|
||||||
|
loadComponent: () => PageComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'page-2',
|
||||||
|
data: {
|
||||||
|
title: 'Page 2',
|
||||||
|
},
|
||||||
|
loadComponent: () => PageComponent,
|
||||||
|
},
|
||||||
|
];
|
||||||
16
apps/forms/form-dialog-alert/src/app/pages/join.component.ts
Normal file
16
apps/forms/form-dialog-alert/src/app/pages/join.component.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
|
import { FormComponent } from '../ui/form.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
standalone: true,
|
||||||
|
imports: [FormComponent],
|
||||||
|
template: `
|
||||||
|
<section class="mx-auto max-w-screen-sm">
|
||||||
|
<div class="rounded-lg bg-white p-8 shadow-lg lg:p-12">
|
||||||
|
<app-form />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
`,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class JoinComponent {}
|
||||||
14
apps/forms/form-dialog-alert/src/app/pages/page.component.ts
Normal file
14
apps/forms/form-dialog-alert/src/app/pages/page.component.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
standalone: true,
|
||||||
|
template: `
|
||||||
|
<section>
|
||||||
|
<h1>{{ title() }}</h1>
|
||||||
|
</section>
|
||||||
|
`,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class PageComponent {
|
||||||
|
title = input.required<string>();
|
||||||
|
}
|
||||||
30
apps/forms/form-dialog-alert/src/app/ui/dialog.component.ts
Normal file
30
apps/forms/form-dialog-alert/src/app/ui/dialog.component.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
|
|
||||||
|
// NOTE : this is just the dialog content, you need to implement dialog logic
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
standalone: true,
|
||||||
|
template: `
|
||||||
|
<div role="alert" class="rounded-xl border border-gray-100 bg-white p-5">
|
||||||
|
<h3 class="block text-xl font-medium text-red-600">
|
||||||
|
You have unsaved information!
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<p class="mt-1 text-gray-700">Do you want to continue and lose them?</p>
|
||||||
|
|
||||||
|
<div class="mt-4 flex gap-2">
|
||||||
|
<button
|
||||||
|
class="inline-flex items-center gap-2 rounded-lg bg-red-600 px-4 py-2 text-white hover:bg-red-700">
|
||||||
|
Yes continue
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="block rounded-lg px-4 py-2 text-gray-700 transition hover:bg-gray-50">
|
||||||
|
Stay on page
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class AlertDialogComponent {}
|
||||||
78
apps/forms/form-dialog-alert/src/app/ui/form.component.ts
Normal file
78
apps/forms/form-dialog-alert/src/app/ui/form.component.ts
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||||
|
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-form',
|
||||||
|
standalone: true,
|
||||||
|
imports: [ReactiveFormsModule],
|
||||||
|
template: `
|
||||||
|
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label class="sr-only" for="name">Name</label>
|
||||||
|
<input
|
||||||
|
class="w-full rounded-lg border-gray-200 p-3 text-sm"
|
||||||
|
placeholder="Name"
|
||||||
|
type="text"
|
||||||
|
formControlName="name"
|
||||||
|
id="name" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<label class="sr-only" for="email">Email</label>
|
||||||
|
<input
|
||||||
|
class="w-full rounded-lg border-gray-200 p-3 text-sm"
|
||||||
|
placeholder="Email address"
|
||||||
|
type="email"
|
||||||
|
formControlName="email"
|
||||||
|
id="email" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label class="sr-only" for="phone">Phone</label>
|
||||||
|
<input
|
||||||
|
class="w-full rounded-lg border-gray-200 p-3 text-sm"
|
||||||
|
placeholder="Phone Number"
|
||||||
|
type="tel"
|
||||||
|
formControlName="phone"
|
||||||
|
id="phone" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label class="sr-only" for="message">Message</label>
|
||||||
|
|
||||||
|
<textarea
|
||||||
|
class="w-full rounded-lg border-gray-200 p-3 text-sm"
|
||||||
|
placeholder="Message"
|
||||||
|
rows="8"
|
||||||
|
formControlName="message"
|
||||||
|
id="message"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
<button
|
||||||
|
[disabled]="form.invalid"
|
||||||
|
type="submit"
|
||||||
|
class="inline-block w-full rounded-lg border bg-gray-50 px-5 py-3 font-medium text-gray-900 disabled:cursor-not-allowed disabled:bg-gray-300 sm:w-auto">
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
`,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class FormComponent {
|
||||||
|
private fb = inject(FormBuilder);
|
||||||
|
|
||||||
|
form = this.fb.nonNullable.group({
|
||||||
|
name: ['', { validators: [Validators.required] }],
|
||||||
|
email: ['', [Validators.required, Validators.email]], // other syntax
|
||||||
|
phone: '',
|
||||||
|
message: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if (this.form.valid) this.form.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
33
apps/forms/form-dialog-alert/src/app/ui/nav.component.ts
Normal file
33
apps/forms/form-dialog-alert/src/app/ui/nav.component.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
|
import { RouterLink, RouterLinkActive } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-nav',
|
||||||
|
standalone: true,
|
||||||
|
imports: [RouterLink, RouterLinkActive],
|
||||||
|
template: `
|
||||||
|
<nav
|
||||||
|
class="inline-flex overflow-hidden rounded-md border bg-white shadow-sm">
|
||||||
|
<a
|
||||||
|
routerLink="/form"
|
||||||
|
routerLinkActive="bg-gray-300 hover:bg-gray-300"
|
||||||
|
class="inline-block px-4 py-2 text-sm font-medium text-gray-900 hover:bg-gray-100 focus:relative">
|
||||||
|
Form
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
routerLink="/page-1"
|
||||||
|
routerLinkActive="bg-gray-300 hover:bg-gray-300"
|
||||||
|
class="inline-block px-4 py-2 text-sm font-medium text-gray-900 hover:bg-gray-100 focus:relative">
|
||||||
|
Page 1
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
routerLink="/page-2"
|
||||||
|
routerLinkActive="bg-gray-300 hover:bg-gray-300"
|
||||||
|
class="inline-block px-4 py-2 text-sm font-medium text-gray-900 hover:bg-gray-100 focus:relative">
|
||||||
|
Page 2
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
`,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class NavComponent {}
|
||||||
0
apps/forms/form-dialog-alert/src/assets/.gitkeep
Normal file
0
apps/forms/form-dialog-alert/src/assets/.gitkeep
Normal file
BIN
apps/forms/form-dialog-alert/src/favicon.ico
Normal file
BIN
apps/forms/form-dialog-alert/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
13
apps/forms/form-dialog-alert/src/index.html
Normal file
13
apps/forms/form-dialog-alert/src/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>form-dialog-alert</title>
|
||||||
|
<base href="/" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
7
apps/forms/form-dialog-alert/src/main.ts
Normal file
7
apps/forms/form-dialog-alert/src/main.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
|
import { AppComponent } from './app/app.component';
|
||||||
|
import { appConfig } from './app/app.config';
|
||||||
|
|
||||||
|
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
||||||
|
console.error(err),
|
||||||
|
);
|
||||||
5
apps/forms/form-dialog-alert/src/styles.scss
Normal file
5
apps/forms/form-dialog-alert/src/styles.scss
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
/* You can add global styles to this file, and also import other style files */
|
||||||
16
apps/forms/form-dialog-alert/tailwind.config.js
Normal file
16
apps/forms/form-dialog-alert/tailwind.config.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
|
||||||
|
const { join } = require('path');
|
||||||
|
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: [
|
||||||
|
join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'),
|
||||||
|
...createGlobPatternsForDependencies(__dirname),
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
require('@tailwindcss/forms'),
|
||||||
|
],
|
||||||
|
};
|
||||||
10
apps/forms/form-dialog-alert/tsconfig.app.json
Normal file
10
apps/forms/form-dialog-alert/tsconfig.app.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../../dist/out-tsc",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": ["src/main.ts"],
|
||||||
|
"include": ["src/**/*.d.ts"],
|
||||||
|
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
|
||||||
|
}
|
||||||
6
apps/forms/form-dialog-alert/tsconfig.editor.json
Normal file
6
apps/forms/form-dialog-alert/tsconfig.editor.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": ["src/**/*.ts"],
|
||||||
|
"compilerOptions": {},
|
||||||
|
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
|
||||||
|
}
|
||||||
30
apps/forms/form-dialog-alert/tsconfig.json
Normal file
30
apps/forms/form-dialog-alert/tsconfig.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2022",
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.editor.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"total": 47,
|
"total": 48,
|
||||||
"🟢": 18,
|
"🟢": 18,
|
||||||
"🟠": 120,
|
"🟠": 121,
|
||||||
"🔴": 209
|
"🔴": 209
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ interface Props {
|
|||||||
twitter?: string;
|
twitter?: string;
|
||||||
linkedin?: string;
|
linkedin?: string;
|
||||||
github?: string;
|
github?: string;
|
||||||
|
youtube?: string;
|
||||||
labels?: Record<string, string>;
|
labels?: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, twitter, linkedin, github, data } = Astro.props;
|
const { name, twitter, linkedin, github, youtube, data } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<p class="author">
|
<p class="author">
|
||||||
@@ -23,6 +24,9 @@ const { name, twitter, linkedin, github, data } = Astro.props;
|
|||||||
{github && <a href={github}>
|
{github && <a href={github}>
|
||||||
<Icon class="icon" name="github" size="0.75rem" />
|
<Icon class="icon" name="github" size="0.75rem" />
|
||||||
</a>}
|
</a>}
|
||||||
|
{youtube && <a href={youtube}>
|
||||||
|
<Icon class="icon" name="youtube" size="0.75rem" />
|
||||||
|
</a>}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
7
docs/src/content/authors/timothy-alcaide.json
Normal file
7
docs/src/content/authors/timothy-alcaide.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "Timothy Alcaide",
|
||||||
|
"github": "https://github.com/alcaidio",
|
||||||
|
"youtube": "https://www.youtube.com/@timothyalcaide",
|
||||||
|
"twitter": "https://twitter.com/alcaidio",
|
||||||
|
"linkedin": "https://www.linkedin.com/in/timothyalcaide"
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ const authors = defineCollection({
|
|||||||
twitter: z.string().url().optional(),
|
twitter: z.string().url().optional(),
|
||||||
linkedin: z.string().url().optional(),
|
linkedin: z.string().url().optional(),
|
||||||
github: z.string().url().optional(),
|
github: z.string().url().optional(),
|
||||||
|
youtube: z.string().url().optional(),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
title: 🟠 Avoid losing form data
|
||||||
|
description: Challenge 48 is about Bob 🧙♂️ the product owner, he wants to develop a new feature in response to customer complaints about losing form input information.
|
||||||
|
author: timothy-alcaide
|
||||||
|
contributors:
|
||||||
|
- alcaidio
|
||||||
|
challengeNumber: 48
|
||||||
|
command: form-dialog-alert
|
||||||
|
sidebar:
|
||||||
|
order: 121
|
||||||
|
badge: New
|
||||||
|
---
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
As a member of the development team, you need to address a specific request from the product owner, 🧙♂️ Bob. He wants to develop a new feature in response to customer complaints about losing form input information.
|
||||||
|
|
||||||
|
## User Story
|
||||||
|
|
||||||
|
Here's the feature expressed as a user story (functional expectation) :
|
||||||
|
|
||||||
|
"As a user, I would like to have an alert dialog box that appears when I attempt to navigate away from the /form page after I have started entering information into the form."
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
1. On the /form page:
|
||||||
|
|
||||||
|
- If the input text has been pre-filled, then an alert dialog box opens.
|
||||||
|
- Otherwise, the user navigates normally.
|
||||||
|
|
||||||
|
2. The content of `dialog.component.ts` must be use for your dialog box content.
|
||||||
|
3. The appearance and behavior of the alert dialog box must comply with W3C conventions, see [alert dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/).
|
||||||
|
4. Maximize the use of the new concepts and syntax in the latest version of Angular.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Tips 🤫 (if you really need it and after careful consideration)</summary>
|
||||||
|
<ul>
|
||||||
|
<li>Use the Material CDK Dialog or Overlay - https://material.angular.io/cdk/ (dont forget to add @import '@angular/cdk/overlay-prebuilt.css' in style.sccss)</li>
|
||||||
|
<li>Use the CanDeactivate guard - https://angular.io/api/router/CanDeactivate (use new functionnal approach).</li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
@@ -9,7 +9,6 @@ challengeNumber: 47
|
|||||||
command: typescript-enums-vs-union-types
|
command: typescript-enums-vs-union-types
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 18
|
order: 18
|
||||||
badge: New
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Information
|
## Information
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ hero:
|
|||||||
icon: right-arrow
|
icon: right-arrow
|
||||||
variant: primary
|
variant: primary
|
||||||
- text: Ir al Desafío más reciente
|
- text: Ir al Desafío más reciente
|
||||||
link: /es/challenges/typescript/47-enums-vs-union-types/
|
link: /es/challenges/forms/48-form-dialog-alert/
|
||||||
icon: rocket
|
icon: rocket
|
||||||
- text: Dar una estrella
|
- text: Dar una estrella
|
||||||
link: https://github.com/tomalaforge/angular-challenges
|
link: https://github.com/tomalaforge/angular-challenges
|
||||||
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
|
|||||||
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
||||||
|
|
||||||
<CardGrid>
|
<CardGrid>
|
||||||
<Card title="47 Desafíos">
|
<Card title="48 Desafíos">
|
||||||
Este repositorio contiene 47 Desafíos relacionados con <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> y <b>Typescript</b>.
|
Este repositorio contiene 48 Desafíos relacionados con <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> y <b>Typescript</b>.
|
||||||
Estos desafíos se resuelven en torno a problemas de la vida real o características específicas para mejorar tus habilidades.
|
Estos desafíos se resuelven en torno a problemas de la vida real o características específicas para mejorar tus habilidades.
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ hero:
|
|||||||
icon: right-arrow
|
icon: right-arrow
|
||||||
variant: primary
|
variant: primary
|
||||||
- text: Aller au dernier Challenge
|
- text: Aller au dernier Challenge
|
||||||
link: /fr/challenges/typescript/47-enums-vs-union-types/
|
link: /fr/challenges/forms/48-form-dialog-alert/
|
||||||
icon: rocket
|
icon: rocket
|
||||||
- text: Donne une étoile
|
- text: Donne une étoile
|
||||||
link: https://github.com/tomalaforge/angular-challenges
|
link: https://github.com/tomalaforge/angular-challenges
|
||||||
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
|
|||||||
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
||||||
|
|
||||||
<CardGrid>
|
<CardGrid>
|
||||||
<Card title="47 Défis">
|
<Card title="48 Défis">
|
||||||
Ce répertoire rassemble 47 Défis liés à <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> et <b>Typescript</b>. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences.
|
Ce répertoire rassemble 48 Défis liés à <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> et <b>Typescript</b>. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences.
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card title="Subscribe to get notify of latest challenges">
|
<Card title="Subscribe to get notify of latest challenges">
|
||||||
|
|||||||
@@ -26,10 +26,9 @@ import MyIcon from '../../components/MyIcon.astro';
|
|||||||
|
|
||||||
import SubscriptionForm from '../../components/SubscriptionForm.astro';
|
import SubscriptionForm from '../../components/SubscriptionForm.astro';
|
||||||
|
|
||||||
|
|
||||||
<CardGrid>
|
<CardGrid>
|
||||||
<Card title="47 Challenges">
|
<Card title="48 Challenges">
|
||||||
This repository gathers 47 Challenges related to <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> and <b>Typescript</b>.
|
This repository gathers 48 Challenges related to <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> and <b>Typescript</b>.
|
||||||
These challenges resolve around real-life issues or specific features to elevate your skills.
|
These challenges resolve around real-life issues or specific features to elevate your skills.
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ hero:
|
|||||||
icon: right-arrow
|
icon: right-arrow
|
||||||
variant: primary
|
variant: primary
|
||||||
- text: Ir para o desafio mais recente
|
- text: Ir para o desafio mais recente
|
||||||
link: /pt/challenges/typescript/47-enums-vs-union-types/
|
link: /pt/challenges/forms/48-form-dialog-alert/
|
||||||
icon: rocket
|
icon: rocket
|
||||||
- text: Dar uma estrela
|
- text: Dar uma estrela
|
||||||
link: https://github.com/tomalaforge/angular-challenges
|
link: https://github.com/tomalaforge/angular-challenges
|
||||||
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
|
|||||||
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
|
||||||
|
|
||||||
<CardGrid>
|
<CardGrid>
|
||||||
<Card title="47 Desafios">
|
<Card title="48 Desafios">
|
||||||
Este repositório possui 47 Desafios relacionados a <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>,
|
Este repositório possui 48 Desafios relacionados a <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>,
|
||||||
<b>Ngrx</b> e <b>Typescript</b>.
|
<b>Ngrx</b> e <b>Typescript</b>.
|
||||||
Esses desafios são voltados para problemas reais ou funcionalidades específicas afim de
|
Esses desafios são voltados para problemas reais ou funcionalidades específicas afim de
|
||||||
melhorar suas habilidades.
|
melhorar suas habilidades.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ hero:
|
|||||||
icon: right-arrow
|
icon: right-arrow
|
||||||
variant: primary
|
variant: primary
|
||||||
- text: Перейти к последней задаче
|
- text: Перейти к последней задаче
|
||||||
link: /ru/challenges/typescript/47-enums-vs-union-types/
|
link: /ru/challenges/forms/48-form-dialog-alert/
|
||||||
icon: rocket
|
icon: rocket
|
||||||
- text: Добавить звезду
|
- text: Добавить звезду
|
||||||
link: https://github.com/tomalaforge/angular-challenges
|
link: https://github.com/tomalaforge/angular-challenges
|
||||||
|
|||||||
11
nx.json
11
nx.json
@@ -30,6 +30,11 @@
|
|||||||
"{workspaceRoot}/tools/eslint-rules/**/*"
|
"{workspaceRoot}/tools/eslint-rules/**/*"
|
||||||
],
|
],
|
||||||
"cache": true
|
"cache": true
|
||||||
|
},
|
||||||
|
"@angular-devkit/build-angular:application": {
|
||||||
|
"cache": true,
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"inputs": ["production", "^production"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"namedInputs": {
|
"namedInputs": {
|
||||||
@@ -52,10 +57,10 @@
|
|||||||
},
|
},
|
||||||
"generators": {
|
"generators": {
|
||||||
"@nx/angular:application": {
|
"@nx/angular:application": {
|
||||||
"style": "scss",
|
|
||||||
"linter": "eslint",
|
|
||||||
"unitTestRunner": "none",
|
|
||||||
"e2eTestRunner": "none",
|
"e2eTestRunner": "none",
|
||||||
|
"linter": "eslint",
|
||||||
|
"style": "scss",
|
||||||
|
"unitTestRunner": "none",
|
||||||
"inlineStyle": "true",
|
"inlineStyle": "true",
|
||||||
"inlineTemplate": "true",
|
"inlineTemplate": "true",
|
||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
|
|||||||
8732
package-lock.json
generated
8732
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -67,6 +67,7 @@
|
|||||||
"@swc-node/register": "1.8.0",
|
"@swc-node/register": "1.8.0",
|
||||||
"@swc/cli": "~0.1.62",
|
"@swc/cli": "~0.1.62",
|
||||||
"@swc/core": "1.3.94",
|
"@swc/core": "1.3.94",
|
||||||
|
"@tailwindcss/forms": "^0.5.7",
|
||||||
"@tanstack/angular-query-devtools-experimental": "^5.12.1",
|
"@tanstack/angular-query-devtools-experimental": "^5.12.1",
|
||||||
"@testing-library/angular": "15.1.0",
|
"@testing-library/angular": "15.1.0",
|
||||||
"@testing-library/cypress": "10.0.1",
|
"@testing-library/cypress": "10.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user