diff --git a/.all-contributorsrc b/.all-contributorsrc index 38856b4..5e94f8a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -79,6 +79,15 @@ "translation-ru" ] }, + { + "login": "wandri", + "name": "Wandrille", + "avatar_url": "https://avatars.githubusercontent.com/u/15016833?v=4", + "profile": "https://wandrille-guesdon.com/", + "contributions": [ + "challenge" + ] + }, { "login": "alan-bio", "name": "Alan Dragicevich", @@ -201,6 +210,15 @@ "contributions": [ "doc" ] + }, + { + "login": "svenson95", + "name": "Sven Brodny", + "avatar_url": "https://avatars.githubusercontent.com/u/46655156?v=4", + "profile": "https://svenson95.github.io/sb-portfolio/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 1e43bdf..a350212 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ If you would like to propose a challenge, this project is open source, so feel f ## Challenges -Check [all 44 challenges](https://angular-challenges.vercel.app/) +Check [all 45 challenges](https://angular-challenges.vercel.app/) ## Contributors ✨ @@ -38,23 +38,25 @@ Check [all 44 challenges](https://angular-challenges.vercel.app/) J. Degand
J. Degand

📖 🖋 💻 Devesh Chaudhari
Devesh Chaudhari

💻 🐛 🧩 stillst
stillst

🧩 🇷🇺 + Wandrille
Wandrille

🧩 Alan Dragicevich
Alan Dragicevich

📖 Michel EDIGHOFFER
Michel EDIGHOFFER

📖 - Gerardo Sebastian Gonzalez
Gerardo Sebastian Gonzalez

📖 + Gerardo Sebastian Gonzalez
Gerardo Sebastian Gonzalez

📖 Evseev Yuriy
Evseev Yuriy

🐛 Tomer953
Tomer953

🐛 📖 💻 Dmitriy Mishchenko
Dmitriy Mishchenko

📖 Sagar Devkota
Sagar Devkota

📖 💻 Nelson Gutierrez
Nelson Gutierrez

🇪🇸 Hossain K. M.
Hossain K. M.

📖 - Diogo Nishikawa
Diogo Nishikawa

💻 🇵🇹 📖 + Diogo Nishikawa
Diogo Nishikawa

💻 🇵🇹 📖 Erick Rodriguez
Erick Rodriguez

🇪🇸 Eduardo Roth
Eduardo Roth

📖 🇪🇸 Fernando Bello
Fernando Bello

📖 + Sven Brodny
Sven Brodny

📖 diff --git a/apps/angular/react-in-angular/.eslintrc.json b/apps/angular/react-in-angular/.eslintrc.json new file mode 100644 index 0000000..8ebcbfd --- /dev/null +++ b/apps/angular/react-in-angular/.eslintrc.json @@ -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": {} + } + ] +} diff --git a/apps/angular/react-in-angular/README.md b/apps/angular/react-in-angular/README.md new file mode 100644 index 0000000..0a8679a --- /dev/null +++ b/apps/angular/react-in-angular/README.md @@ -0,0 +1,13 @@ +# React in angular + +> author: wandrille-guesdon + +### Run Application + +```bash +npx nx serve angular-react-in-angular +``` + +### Documentation and Instruction + +Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/45-react-in-angular/). diff --git a/apps/angular/react-in-angular/jest.config.ts b/apps/angular/react-in-angular/jest.config.ts new file mode 100644 index 0000000..92d5f25 --- /dev/null +++ b/apps/angular/react-in-angular/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'angular-react-in-angular', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../coverage/apps/angular/react-in-angular', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/apps/angular/react-in-angular/project.json b/apps/angular/react-in-angular/project.json new file mode 100644 index 0000000..8153ec8 --- /dev/null +++ b/apps/angular/react-in-angular/project.json @@ -0,0 +1,80 @@ +{ + "name": "angular-react-in-angular", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "prefix": "app", + "sourceRoot": "apps/angular/react-in-angular/src", + "tags": [], + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:application", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/angular/react-in-angular", + "index": "apps/angular/react-in-angular/src/index.html", + "browser": "apps/angular/react-in-angular/src/main.ts", + "polyfills": ["zone.js"], + "tsConfig": "apps/angular/react-in-angular/tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "apps/angular/react-in-angular/src/favicon.ico", + "apps/angular/react-in-angular/src/assets" + ], + "styles": ["apps/angular/react-in-angular/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": "angular-react-in-angular:build:production" + }, + "development": { + "buildTarget": "angular-react-in-angular:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "angular-react-in-angular:build" + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"] + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "apps/angular/react-in-angular/jest.config.ts" + } + } + } +} diff --git a/apps/angular/react-in-angular/src/app/app.component.ts b/apps/angular/react-in-angular/src/app/app.component.ts new file mode 100644 index 0000000..a914cc6 --- /dev/null +++ b/apps/angular/react-in-angular/src/app/app.component.ts @@ -0,0 +1,62 @@ +import { Component, signal } from '@angular/core'; +import { PostComponent } from './react/post.component'; + +type Post = { title: string; description: string }; + +@Component({ + standalone: true, + imports: [PostComponent], + selector: 'app-root', + template: ` +
+
+ @for (post of posts; track post.title) { +
+ +
+ } +
+
+ Selected Post: + + {{ selectedPost()?.title ?? '-' }} + +
+
+ `, + styles: [''], +}) +export class AppComponent { + readonly posts = [ + { + title: 'A Deep Dive into Angular', + description: + "Explore Angular's core features, its evolution, and best practices in development for creating dynamic, efficient web applications in our comprehensive guide.", + pictureLink: + 'https://images.unsplash.com/photo-1471958680802-1345a694ba6d', + }, + { + title: 'The Perfect Combination', + description: + 'Unveil the power of combining Angular & React in web development, maximizing efficiency and flexibility for building scalable, sophisticated applications.', + pictureLink: + 'https://images.unsplash.com/photo-1518717202715-9fa9d099f58a', + }, + { + title: 'Taking Angular to the Next Level', + description: + "Discover how integrating React with Angular elevates web development, blending Angular's structure with React's UI prowess for advanced applications.", + pictureLink: + 'https://images.unsplash.com/photo-1532103050105-860af53bc6aa', + }, + ]; + + readonly selectedPost = signal(null); + + selectPost(post: Post) { + this.selectedPost.set(post); + } +} diff --git a/apps/angular/react-in-angular/src/app/app.config.ts b/apps/angular/react-in-angular/src/app/app.config.ts new file mode 100644 index 0000000..81a6edd --- /dev/null +++ b/apps/angular/react-in-angular/src/app/app.config.ts @@ -0,0 +1,5 @@ +import { ApplicationConfig } from '@angular/core'; + +export const appConfig: ApplicationConfig = { + providers: [], +}; diff --git a/apps/angular/react-in-angular/src/app/react/ReactPost.tsx b/apps/angular/react-in-angular/src/app/react/ReactPost.tsx new file mode 100644 index 0000000..6ff7b4d --- /dev/null +++ b/apps/angular/react-in-angular/src/app/react/ReactPost.tsx @@ -0,0 +1,27 @@ +// import React from 'react'; + +export default function ReactPost(props: { + title?: string, + description?: string, + pictureLink?: string, + selected?: boolean, + handleClick: () => void +}) { + return ( +
+
+ {props.title} +
+
{props.title}
+

+ {props.description} +

+ +
+
+
+ ); +} diff --git a/apps/angular/react-in-angular/src/app/react/post.component.ts b/apps/angular/react-in-angular/src/app/react/post.component.ts new file mode 100644 index 0000000..2a35eac --- /dev/null +++ b/apps/angular/react-in-angular/src/app/react/post.component.ts @@ -0,0 +1,17 @@ +import { Component, EventEmitter, input, Output } from '@angular/core'; + +type Post = { title: string; description: string; pictureLink: string }; + +@Component({ + standalone: true, + selector: 'app-post', + template: ` +
+ `, + styles: [''], +}) +export class PostComponent { + post = input(undefined); + isSelected = input(false); + @Output() selectPost = new EventEmitter(); +} diff --git a/apps/angular/react-in-angular/src/assets/.gitkeep b/apps/angular/react-in-angular/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/angular/react-in-angular/src/favicon.ico b/apps/angular/react-in-angular/src/favicon.ico new file mode 100644 index 0000000..317ebcb Binary files /dev/null and b/apps/angular/react-in-angular/src/favicon.ico differ diff --git a/apps/angular/react-in-angular/src/index.html b/apps/angular/react-in-angular/src/index.html new file mode 100644 index 0000000..9d9dd39 --- /dev/null +++ b/apps/angular/react-in-angular/src/index.html @@ -0,0 +1,13 @@ + + + + + angular-react-in-angular + + + + + + + + diff --git a/apps/angular/react-in-angular/src/main.ts b/apps/angular/react-in-angular/src/main.ts new file mode 100644 index 0000000..f3a7223 --- /dev/null +++ b/apps/angular/react-in-angular/src/main.ts @@ -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), +); diff --git a/apps/angular/react-in-angular/src/styles.scss b/apps/angular/react-in-angular/src/styles.scss new file mode 100644 index 0000000..77e408a --- /dev/null +++ b/apps/angular/react-in-angular/src/styles.scss @@ -0,0 +1,5 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/angular/react-in-angular/src/test-setup.ts b/apps/angular/react-in-angular/src/test-setup.ts new file mode 100644 index 0000000..15de72a --- /dev/null +++ b/apps/angular/react-in-angular/src/test-setup.ts @@ -0,0 +1,2 @@ +import '@testing-library/jest-dom'; +import 'jest-preset-angular/setup-jest'; diff --git a/apps/angular/react-in-angular/tailwind.config.js b/apps/angular/react-in-angular/tailwind.config.js new file mode 100644 index 0000000..38183db --- /dev/null +++ b/apps/angular/react-in-angular/tailwind.config.js @@ -0,0 +1,14 @@ +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: [], +}; diff --git a/apps/angular/react-in-angular/tsconfig.app.json b/apps/angular/react-in-angular/tsconfig.app.json new file mode 100644 index 0000000..5822042 --- /dev/null +++ b/apps/angular/react-in-angular/tsconfig.app.json @@ -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"] +} diff --git a/apps/angular/react-in-angular/tsconfig.editor.json b/apps/angular/react-in-angular/tsconfig.editor.json new file mode 100644 index 0000000..8ae117d --- /dev/null +++ b/apps/angular/react-in-angular/tsconfig.editor.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "compilerOptions": { + "types": ["jest", "node"] + } +} diff --git a/apps/angular/react-in-angular/tsconfig.json b/apps/angular/react-in-angular/tsconfig.json new file mode 100644 index 0000000..7a9f4b7 --- /dev/null +++ b/apps/angular/react-in-angular/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json", + }, + { + "path": "./tsconfig.spec.json", + }, + { + "path": "./tsconfig.editor.json", + }, + ], + "extends": "../../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true, + }, +} diff --git a/apps/angular/react-in-angular/tsconfig.spec.json b/apps/angular/react-in-angular/tsconfig.spec.json new file mode 100644 index 0000000..1a4817a --- /dev/null +++ b/apps/angular/react-in-angular/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node", "@testing-library/jest-dom"] + }, + "files": ["src/test-setup.ts"], + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/challenge-number.json b/challenge-number.json index a48a4f1..6970465 100644 --- a/challenge-number.json +++ b/challenge-number.json @@ -1,6 +1,6 @@ { - "total": 44, + "total": 45, "🟢": 16, "🟠": 120, - "🔴": 208 + "🔴": 209 } diff --git a/docs/src/content/authors/wandrille-guesdon.json b/docs/src/content/authors/wandrille-guesdon.json new file mode 100644 index 0000000..a240cba --- /dev/null +++ b/docs/src/content/authors/wandrille-guesdon.json @@ -0,0 +1,5 @@ +{ + "name": "Wandrille Guesdon", + "linkedin": "https://www.linkedin.com/in/wandrille-guesdon-53a54684/", + "github": "https://github.com/wandri" +} diff --git a/docs/src/content/docs/challenges/angular/1-projection.md b/docs/src/content/docs/challenges/angular/1-projection.md index 1602510..f3409b1 100644 --- a/docs/src/content/docs/challenges/angular/1-projection.md +++ b/docs/src/content/docs/challenges/angular/1-projection.md @@ -40,4 +40,4 @@ While the application works, the developer experience is far from being optimal. - Try to work with the new built-in control flow syntax for loops and conditionals (documentation [here](https://angular.dev/guide/templates/control-flow)) - Use the signal API to manage your components state (documentation [here](https://angular.dev/guide/signals)) -- To reference the template, use a directive instead of magic strings +- To reference the template, use a directive instead of magic strings ([What is wrong with magic strings?](https://softwareengineering.stackexchange.com/a/365344)) diff --git a/docs/src/content/docs/challenges/angular/22-router-input.md b/docs/src/content/docs/challenges/angular/22-router-input.md index 75ac297..59676ce 100644 --- a/docs/src/content/docs/challenges/angular/22-router-input.md +++ b/docs/src/content/docs/challenges/angular/22-router-input.md @@ -23,4 +23,4 @@ In version 16, Angular introduced a new `Input` that can listen to route data. Y ## Statement -The goal of this exercice is to refactor the code to use the new `RouterInput` strategy. +The goal of this exercise is to refactor the code to use the new `RouterInput` strategy. diff --git a/docs/src/content/docs/challenges/angular/3-directive-enhancement.md b/docs/src/content/docs/challenges/angular/3-directive-enhancement.md index 41a0cad..be7b764 100644 --- a/docs/src/content/docs/challenges/angular/3-directive-enhancement.md +++ b/docs/src/content/docs/challenges/angular/3-directive-enhancement.md @@ -10,20 +10,20 @@ sidebar: --- :::note -This exercice can feel obsolete with the new control flow and the empty block inside the `@for` block. However **structural directives** are not going to be deleted any time soon, so you can still learn a lot from this exercice. +This exercise can feel obsolete with the new control flow and the empty block inside the `@for` block. However **structural directives** are not going to be deleted any time soon, so you can still learn a lot from this exercise. ::: ## Information -Directive is a very powerful tool only offered by the Angular framework. You can apply the DRY principal by having shared logic inside a directive and applying it to any component you want. +Directive is a very powerful tool only offered by the Angular framework. You can apply the DRY principle by having shared logic inside a directive and applying it to any component you want. But the real power is that you can enhance an already existing directive which moreover doesn't **belong** to you. ## Statement -In this exercice, we have a want to display a list of persons. If the list is empty, you must display _" the list is empty !! "_. +In this exercise, we have a want to display a list of persons. If the list is empty, you must display _" the list is empty !! "_. -Currently we have : +Currently we have: ```typescript @@ -34,7 +34,7 @@ Currently we have : The list is empty !! ``` -We want to get rid of the ng-container by writing : +We want to get rid of the `ng-container` by writing: ```typescript
@@ -43,4 +43,4 @@ We want to get rid of the ng-container by writing : The list is empty !! ``` -The goal is to **improve the ngFor directive** +The goal is to **improve the ngFor directive**. diff --git a/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md b/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md index 43f8a2d..88d4e5b 100644 --- a/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md +++ b/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md @@ -17,9 +17,9 @@ However the context of **NgTemplateOutlet** type is **Object**. But with the hel ## Statement -In this exercice, we want to learn how to strongly type our ng-template in our AppComponent. +In this exercise, we want to learn how to strongly type our ng-template in our AppComponent. -This exercice has two levels of complexity. +This exercise has two levels of complexity. ### Level 1: known Interface diff --git a/docs/src/content/docs/challenges/angular/44-view-transition.md b/docs/src/content/docs/challenges/angular/44-view-transition.md index 46ae580..6dbf211 100644 --- a/docs/src/content/docs/challenges/angular/44-view-transition.md +++ b/docs/src/content/docs/challenges/angular/44-view-transition.md @@ -6,7 +6,6 @@ challengeNumber: 44 command: angular-view-transition sidebar: order: 208 - badge: New --- ## Information diff --git a/docs/src/content/docs/challenges/angular/45-react-in-angular.md b/docs/src/content/docs/challenges/angular/45-react-in-angular.md new file mode 100644 index 0000000..96443c7 --- /dev/null +++ b/docs/src/content/docs/challenges/angular/45-react-in-angular.md @@ -0,0 +1,77 @@ +--- +title: 🔴 React in angular +description: Challenge 45 is about learning how to benefit from the numerous libraries in React +author: wandrille-guesdon +challengeNumber: 45 +command: angular-react-in-angular +sidebar: + order: 209 + badge: New +--- + +The goal of this challenge is to use a React component inside an Angular application. + +Many components are available in React, and it can be interesting to use them in an Angular application. The goal is to create a React component and use it in an Angular application. + +## Information + +In this challenge, we have a simple application and a react component `ReactPost` in `app/react` to illustrate a react component from a library. + +## Statement + +- Your task is to display the posts with the React component `ReactPost`. +- When you select a post, the post should be highlighted. + +In order to play with the react component, you should start by installing the react dependencies. + +```bash +npm i --save react react-dom +npm i --save-dev @types/react @types/react-dom +``` + +## Constraints + +- Do not transform the react component in an angular component. The React component is pretty simple and can be written with ease in Angular. But **the goal is to use the React component**. + +### Hint + +
+ Hint 1 - Configuration + Allow the React files in tsconfig.json + +``` +{ +... +"compilerOptions": { + ... + "jsx": "react" +}, +... +} +``` + +
+ +
+ Hint 2 - Initialization + Create a react root with `createRoot(...)` +
+ +
+ Hint 3 - Display + To render the component, it should look like this: + + ``` + .render( + + ... + + ) + ``` + +
+ +
+ Hint 4 - Design + Do not forget to allow the react file in Tailwind. +
diff --git a/docs/src/content/docs/challenges/angular/5-crud.md b/docs/src/content/docs/challenges/angular/5-crud.md index dfc909f..9d34d5a 100644 --- a/docs/src/content/docs/challenges/angular/5-crud.md +++ b/docs/src/content/docs/challenges/angular/5-crud.md @@ -14,7 +14,7 @@ Communicating and having a global/local state in sync with your backend is the h ## Statement -In this exercice, you have a small CRUD application, which get a list of TODOS, update and delete some todos. +In this exercise, you have a small CRUD application, which get a list of TODOS, update and delete some todos. Currently we have a working example but filled with lots of bad practices. diff --git a/docs/src/content/docs/challenges/ngrx/2-effect-selector.md b/docs/src/content/docs/challenges/ngrx/2-effect-selector.md index f571bbf..ea7914b 100644 --- a/docs/src/content/docs/challenges/ngrx/2-effect-selector.md +++ b/docs/src/content/docs/challenges/ngrx/2-effect-selector.md @@ -9,7 +9,7 @@ sidebar: order: 113 --- -For this exercice, you will have a dashboard of activities displaying the name, the main teacher and a list of subtitutes. +For this exercise, you will have a dashboard of activities displaying the name, the main teacher and a list of subtitutes. ## Information diff --git a/docs/src/content/docs/es/index.mdx b/docs/src/content/docs/es/index.mdx index e164844..ce07092 100644 --- a/docs/src/content/docs/es/index.mdx +++ b/docs/src/content/docs/es/index.mdx @@ -23,16 +23,16 @@ hero: import { Card, CardGrid } from '@astrojs/starlight/components'; import MyIcon from '../../../components/MyIcon.astro'; -import SubscriptionForm from '../../../components/SubscriptionForm.astro' +import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Este repositorio contiene 44 desafíos relacionados con Angular, Nx, RxJS, Ngrx y Typescript. + + Este repositorio contiene 45 Desafíos relacionados con Angular, Nx, RxJS, Ngrx y Typescript. Estos desafíos se resuelven en torno a problemas de la vida real o características específicas para mejorar tus habilidades. - + @@ -57,7 +57,8 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro' - Completar estos desafíos te preparará para cualquier desafío técnico que puedas encontrar en un rol de frontend durante las entrevistas. + Completar estos desafíos te preparará para cualquier desafío técnico que + puedas encontrar en un rol de frontend durante las entrevistas. diff --git a/docs/src/content/docs/fr/index.mdx b/docs/src/content/docs/fr/index.mdx index 892cda6..2388d8d 100644 --- a/docs/src/content/docs/fr/index.mdx +++ b/docs/src/content/docs/fr/index.mdx @@ -25,15 +25,15 @@ hero: import { Card, CardGrid } from '@astrojs/starlight/components'; import MyIcon from '../../../components/MyIcon.astro'; -import SubscriptionForm from '../../../components/SubscriptionForm.astro' +import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Ce répertoire rassemble 44 défis liés à Angular, Nx, RxJS, Ngrx et Typescript. 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 45 Défis liés à Angular, Nx, RxJS, Ngrx et Typescript. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences. - + diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index 968084a..b9a5715 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -13,7 +13,7 @@ hero: icon: right-arrow variant: primary - text: Go to the latest Challenge - link: /challenges/angular/44-view-transition/ + link: /challenges/angular/45-react-in-angular/ icon: rocket - text: Give a star link: https://github.com/tomalaforge/angular-challenges @@ -24,17 +24,16 @@ hero: import { Card, CardGrid } from '@astrojs/starlight/components'; import MyIcon from '../../components/MyIcon.astro'; -import SubscriptionForm from '../../components/SubscriptionForm.astro' - +import SubscriptionForm from '../../components/SubscriptionForm.astro'; - - This repository gathers 44 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript. + + This repository gathers 45 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript. These challenges resolve around real-life issues or specific features to elevate your skills. - + diff --git a/docs/src/content/docs/pt/challenges/angular/3-directive-enhancement.md b/docs/src/content/docs/pt/challenges/angular/3-directive-enhancement.md new file mode 100644 index 0000000..808f997 --- /dev/null +++ b/docs/src/content/docs/pt/challenges/angular/3-directive-enhancement.md @@ -0,0 +1,46 @@ +--- +title: 🟠 Aprimoramento de Diretiva +description: Desafio 3 é sobre o aprimoramento de uma diretiva nativa +author: thomas-laforge +challengeNumber: 3 +command: angular-ngfor-enhancement +blogLink: https://medium.com/@thomas.laforge/ngfor-enhancement-716b44656a6c +sidebar: + order: 101 +--- + +:::note[Nota] +Este exercício pode ser obsoleto com o novo controle de fluxo e do bloco de empty state dentro do bloco `@for`. No entanto, **diretivas estruturais** não serão removidas tão cedo, por isso você ainda pode aprender bastante com este exercício. +::: + +## Informação + +Diretiva é uma ferramente poderosa oferecida pelo framework Angular. Você pode usar o princípio DRY compartilhando a lógica dentro de uma diretiva e aplicando ela em qualquer componente que quiser. + +Mas a verdadeira vantagem é que você consegue melhorar uma diretiva pré-existente que não **pertence** a você. + +## Declaração + +Neste exercício, queremos mostrar uma lista de pessoas. Se a lista está vazio, você deve mostrar _" the list is empty !! "_. + +Atualmente, temos: + +```typescript + +
+ {{ person.name }} +
+
+ The list is empty !! +``` + +Queremos nos livrar do `ng-container` escrevendo: + +```typescript +
+ {{ person.name }} +
+ The list is empty !! +``` + +Objetivo é **melhorar a diretiva ngFor**. diff --git a/docs/src/content/docs/pt/challenges/angular/44-view-transition.md b/docs/src/content/docs/pt/challenges/angular/44-view-transition.md index 7391bb4..ead29d4 100644 --- a/docs/src/content/docs/pt/challenges/angular/44-view-transition.md +++ b/docs/src/content/docs/pt/challenges/angular/44-view-transition.md @@ -6,7 +6,6 @@ challengeNumber: 44 command: angular-view-transition sidebar: order: 208 - badge: New --- ## Informação diff --git a/docs/src/content/docs/pt/index.mdx b/docs/src/content/docs/pt/index.mdx index 3004dae..a2bd9bb 100644 --- a/docs/src/content/docs/pt/index.mdx +++ b/docs/src/content/docs/pt/index.mdx @@ -23,19 +23,20 @@ hero: import { Card, CardGrid } from '@astrojs/starlight/components'; import MyIcon from '../../../components/MyIcon.astro'; -import SubscriptionForm from '../../../components/SubscriptionForm.astro' +import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Este repositório possui 44 desafios relacionados a Angular, Nx, RxJS, + + Este repositório possui 45 Desafios relacionados a Angular, Nx, RxJS, Ngrx e Typescript. Esses desafios são voltados para problemas reais ou funcionalidades específicas afim de melhorar suas habilidades. - - - +{' '} + + + {' '} diff --git a/docs/src/content/docs/ru/index.mdx b/docs/src/content/docs/ru/index.mdx index ac0cb90..349ac70 100644 --- a/docs/src/content/docs/ru/index.mdx +++ b/docs/src/content/docs/ru/index.mdx @@ -23,36 +23,38 @@ hero: import { Card, CardGrid } from '@astrojs/starlight/components'; import MyIcon from '../../../components/MyIcon.astro'; -import SubscriptionForm from '../../../components/SubscriptionForm.astro' +import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Этот репозиторий содержит 44 испытания, связанных с Angular, Nx, RxJS, Ngrx and Typescript. + + Этот репозиторий содержит 45 Испытания, связанных с Angular, Nx, RxJS, Ngrx and Typescript. Испытания основаны на реальных задачах или инструментах для того, чтобы прокачать вас. - + - Одна из целей этого репозитория снизить барьер для разработки - открытого программного обеспечения (OSS). Решив эти задачи, вы поймете, - как начать вносить свой вклад в любой другой проект с открытым исходным кодом. + Одна из целей этого репозитория снизить барьер для разработки открытого + программного обеспечения (OSS). Решив эти задачи, вы поймете, как начать + вносить свой вклад в любой другой проект с открытым исходным кодом. - Изучение и использование нового фреймворка всегда сопряжено с трудностями. - В этом наборе испытаний содержатся реальные примеры задач, чтобы закрепить на практике то, чему вы научились. - Любой может оставить комментарий или предложить помощь. + Изучение и использование нового фреймворка всегда сопряжено с трудностями. В + этом наборе испытаний содержатся реальные примеры задач, чтобы закрепить на + практике то, чему вы научились. Любой может оставить комментарий или + предложить помощь. - Учиться одному - здорово, но обучение вместе с другими поможет вам добиться большего. + Учиться одному - здорово, но обучение вместе с другими поможет вам добиться + большего. У вас есть идея или интересный баг? Не стесняйтесь;{' '} - Создавайте свои собственные испытания не теряя времени. + Создавайте свои собственные испытания не теряя времени. @@ -61,8 +63,9 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro' - Это бесплатный проект, и он будет оставаться таковым как можно дольше. - Однако вся работа ведется в мое свободное время, включая создание новых испытаний и ревью их решений(PRs). + Это бесплатный проект, и он будет оставаться таковым как можно дольше. Однако + вся работа ведется в мое свободное время, включая создание новых испытаний и + ревью их решений(PRs). Спонсорство может поддержать меня и способствовать развитию проекта.