diff --git a/README.md b/README.md index a350212..8d4d9a0 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 45 challenges](https://angular-challenges.vercel.app/) +Check [all 46 challenges](https://angular-challenges.vercel.app/) ## Contributors ✨ diff --git a/apps/angular/simple-animations/.eslintrc.json b/apps/angular/simple-animations/.eslintrc.json new file mode 100644 index 0000000..8ebcbfd --- /dev/null +++ b/apps/angular/simple-animations/.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/simple-animations/README.md b/apps/angular/simple-animations/README.md new file mode 100644 index 0000000..87e6c7e --- /dev/null +++ b/apps/angular/simple-animations/README.md @@ -0,0 +1,13 @@ +# Simple Animations + +> author: sven-brodny + +### Run Application + +```bash +npx nx serve angular-simple-animations +``` + +### Documentation and Instruction + +Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/46-simple-animations/). diff --git a/apps/angular/simple-animations/jest.config.ts b/apps/angular/simple-animations/jest.config.ts new file mode 100644 index 0000000..8f5d36c --- /dev/null +++ b/apps/angular/simple-animations/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'angular-simple-animations', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../coverage/apps/angular/simple-animations', + 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/simple-animations/project.json b/apps/angular/simple-animations/project.json new file mode 100644 index 0000000..4ba302d --- /dev/null +++ b/apps/angular/simple-animations/project.json @@ -0,0 +1,80 @@ +{ + "name": "angular-simple-animations", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "prefix": "app", + "sourceRoot": "apps/angular/simple-animations/src", + "tags": [], + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:application", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/angular/simple-animations", + "index": "apps/angular/simple-animations/src/index.html", + "browser": "apps/angular/simple-animations/src/main.ts", + "polyfills": ["zone.js"], + "tsConfig": "apps/angular/simple-animations/tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "apps/angular/simple-animations/src/favicon.ico", + "apps/angular/simple-animations/src/assets" + ], + "styles": ["apps/angular/simple-animations/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-simple-animations:build:production" + }, + "development": { + "buildTarget": "angular-simple-animations:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "angular-simple-animations:build" + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"] + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "apps/angular/simple-animations/jest.config.ts" + } + } + } +} diff --git a/apps/angular/simple-animations/src/app/app.component.ts b/apps/angular/simple-animations/src/app/app.component.ts new file mode 100644 index 0000000..9f537b3 --- /dev/null +++ b/apps/angular/simple-animations/src/app/app.component.ts @@ -0,0 +1,88 @@ +import { Component } from '@angular/core'; + +@Component({ + standalone: true, + imports: [], + selector: 'app-root', + styles: ` + section { + @apply flex flex-1 flex-col gap-5; + } + + .list-item { + @apply flex flex-row border-b px-5 pb-2; + + span { + @apply flex-1; + } + } + `, + template: ` +
+
+
+

2008

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae + mollitia sequi accusantium, distinctio similique laudantium eveniet + quidem sit placeat possimus tempore dolorum inventore corporis atque + quae ad, nobis explicabo delectus. +

+
+ +
+

2010

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae + mollitia sequi accusantium, distinctio similique laudantium eveniet + quidem sit placeat possimus tempore dolorum inventore corporis atque + quae ad, nobis explicabo delectus. +

+
+ +
+

2012

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae + mollitia sequi accusantium, distinctio similique laudantium eveniet + quidem sit placeat possimus tempore dolorum inventore corporis atque + quae ad, nobis explicabo delectus. +

+
+
+ +
+
+ Name: + Samuel +
+ +
+ Age: + 28 +
+ +
+ Birthdate: + 02.11.1995 +
+ +
+ City: + Berlin +
+ +
+ Language: + English +
+ +
+ Like Pizza: + Hell yeah +
+
+
+ `, +}) +export class AppComponent {} diff --git a/apps/angular/simple-animations/src/app/app.config.ts b/apps/angular/simple-animations/src/app/app.config.ts new file mode 100644 index 0000000..81a6edd --- /dev/null +++ b/apps/angular/simple-animations/src/app/app.config.ts @@ -0,0 +1,5 @@ +import { ApplicationConfig } from '@angular/core'; + +export const appConfig: ApplicationConfig = { + providers: [], +}; diff --git a/apps/angular/simple-animations/src/assets/.gitkeep b/apps/angular/simple-animations/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/angular/simple-animations/src/favicon.ico b/apps/angular/simple-animations/src/favicon.ico new file mode 100644 index 0000000..317ebcb Binary files /dev/null and b/apps/angular/simple-animations/src/favicon.ico differ diff --git a/apps/angular/simple-animations/src/index.html b/apps/angular/simple-animations/src/index.html new file mode 100644 index 0000000..8fbebf9 --- /dev/null +++ b/apps/angular/simple-animations/src/index.html @@ -0,0 +1,13 @@ + + + + + angular-simple-animations + + + + + + + + diff --git a/apps/angular/simple-animations/src/main.ts b/apps/angular/simple-animations/src/main.ts new file mode 100644 index 0000000..f3a7223 --- /dev/null +++ b/apps/angular/simple-animations/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/simple-animations/src/styles.scss b/apps/angular/simple-animations/src/styles.scss new file mode 100644 index 0000000..77e408a --- /dev/null +++ b/apps/angular/simple-animations/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/simple-animations/src/test-setup.ts b/apps/angular/simple-animations/src/test-setup.ts new file mode 100644 index 0000000..15de72a --- /dev/null +++ b/apps/angular/simple-animations/src/test-setup.ts @@ -0,0 +1,2 @@ +import '@testing-library/jest-dom'; +import 'jest-preset-angular/setup-jest'; diff --git a/apps/angular/simple-animations/tailwind.config.js b/apps/angular/simple-animations/tailwind.config.js new file mode 100644 index 0000000..38183db --- /dev/null +++ b/apps/angular/simple-animations/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/simple-animations/tsconfig.app.json b/apps/angular/simple-animations/tsconfig.app.json new file mode 100644 index 0000000..5822042 --- /dev/null +++ b/apps/angular/simple-animations/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/simple-animations/tsconfig.editor.json b/apps/angular/simple-animations/tsconfig.editor.json new file mode 100644 index 0000000..8ae117d --- /dev/null +++ b/apps/angular/simple-animations/tsconfig.editor.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "compilerOptions": { + "types": ["jest", "node"] + } +} diff --git a/apps/angular/simple-animations/tsconfig.json b/apps/angular/simple-animations/tsconfig.json new file mode 100644 index 0000000..7a9f4b7 --- /dev/null +++ b/apps/angular/simple-animations/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/simple-animations/tsconfig.spec.json b/apps/angular/simple-animations/tsconfig.spec.json new file mode 100644 index 0000000..1a4817a --- /dev/null +++ b/apps/angular/simple-animations/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 6970465..bba17af 100644 --- a/challenge-number.json +++ b/challenge-number.json @@ -1,6 +1,6 @@ { - "total": 45, - "🟢": 16, + "total": 46, + "🟢": 17, "🟠": 120, "🔴": 209 } diff --git a/docs/src/content/authors/sven-brodny.json b/docs/src/content/authors/sven-brodny.json new file mode 100644 index 0000000..3372743 --- /dev/null +++ b/docs/src/content/authors/sven-brodny.json @@ -0,0 +1,5 @@ +{ + "name": "Sven Brodny", + "linkedin": "https://www.linkedin.com/in/sven-brodny-0ba603237/", + "github": "https://github.com/svenson95" +} 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 6dbf211..c9550f6 100644 --- a/docs/src/content/docs/challenges/angular/44-view-transition.md +++ b/docs/src/content/docs/challenges/angular/44-view-transition.md @@ -10,6 +10,8 @@ sidebar: ## Information +This is the second of two animation challenges, the goal of this series is to master animations in Angular. + The View Transition API is a brand new API that provides a set of features that allow developers to control and manipulate the transitions and animations between views within an application. It plays a pivotal role in enhancing the user experience (UX), bringing applications to life with engaging and captivating transitions to guide users through different pages or sections of the app. diff --git a/docs/src/content/docs/challenges/angular/46-simple-animations.md b/docs/src/content/docs/challenges/angular/46-simple-animations.md new file mode 100644 index 0000000..f7c197a --- /dev/null +++ b/docs/src/content/docs/challenges/angular/46-simple-animations.md @@ -0,0 +1,48 @@ +--- +title: 🟢 Simple Animations +description: Challenge 46 is about learning Angular's integrated animation API +author: sven-brodny +challengeNumber: 46 +command: angular-simple-animations +sidebar: + order: 17 + badge: New +--- + +## Information + +This is the first of two animation challenges, the goal of this series is to master animations in Angular. + +Well-designed animations can make your application more fun and straightforward to use, but they aren't just cosmetic. Animations can improve your application and user experience in a number of ways: + +- Without animations, web page transitions can seem abrupt and jarring. +- Motion greatly enhances the user experience, so animations give users a chance to detect the application's response to their actions. +- Good animations intuitively call the user's attention to where it is needed. + +I would recommend you read the [official documentation](https://angular.io/guide/animations). You will learn everything that is necessary to successfully complete the challenge. + +Otherwise look at this [working example](https://svenson95.github.io/ng-xmp-animations/) and [git repo](https://github.com/svenson95/ng-xmp-animations) to get inspired. + +## Statement + +The goal of this challenge is to add animations, they should run when the user arrives on the page or reload the page. + +## Constraints + +- Don't use any CSS and utilize Angular's integrated `@angular/animations` API. +- Don't trigger the animations with a button like in the examples, rather when the user enter or reload the page. + +### Level 1 + +Add a fading or moving animation for the paragraphs on the left side. + + + +### Level 2 + +Add a stagger animation for the list on the right side. + + + diff --git a/docs/src/content/docs/es/index.mdx b/docs/src/content/docs/es/index.mdx index ce07092..deb8340 100644 --- a/docs/src/content/docs/es/index.mdx +++ b/docs/src/content/docs/es/index.mdx @@ -13,7 +13,7 @@ hero: icon: right-arrow variant: primary - text: Ir al Desafío más reciente - link: /es/challenges/angular/43-signal-input/ + link: /es/challenges/angular/46-simple-animations/ icon: rocket - text: Dar una estrella link: https://github.com/tomalaforge/angular-challenges @@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro'; import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Este repositorio contiene 45 Desafíos relacionados con Angular, Nx, RxJS, Ngrx y Typescript. + + Este repositorio contiene 46 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. diff --git a/docs/src/content/docs/fr/index.mdx b/docs/src/content/docs/fr/index.mdx index 2388d8d..d24f92a 100644 --- a/docs/src/content/docs/fr/index.mdx +++ b/docs/src/content/docs/fr/index.mdx @@ -15,7 +15,7 @@ hero: icon: right-arrow variant: primary - text: Aller au dernier Challenge - link: /fr/challenges/angular/44-view-transition/ + link: /fr/challenges/angular/46-simple-animations/ icon: rocket - text: Donne une étoile link: https://github.com/tomalaforge/angular-challenges @@ -28,8 +28,8 @@ import MyIcon from '../../../components/MyIcon.astro'; import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - 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. + + Ce répertoire rassemble 46 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 b9a5715..a172533 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/45-react-in-angular/ + link: /challenges/angular/46-simple-animations/ icon: rocket - text: Give a star link: https://github.com/tomalaforge/angular-challenges @@ -27,8 +27,8 @@ import MyIcon from '../../components/MyIcon.astro'; import SubscriptionForm from '../../components/SubscriptionForm.astro'; - - This repository gathers 45 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript. + + This repository gathers 46 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/44-view-transition.md b/docs/src/content/docs/pt/challenges/angular/44-view-transition.md index ead29d4..0d7e984 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 @@ -10,6 +10,8 @@ sidebar: ## Informação +Este é o segundo de três desafios animation, sendo o objetivo dominar animations em Angular. + A View Transition API é uma nova API que fornece um conjunto de funcionalidades, permitindo desenvolvedores controlarem e manipularem as transições e animações entre views dentro de uma aplicação. Isso tem um papel importante na melhoria da experiência do usuário (UX), trazendo vida a aplicações com transições atraentes e cativantes afim de guiar usuários por diferentes páginas e seções da aplicação. diff --git a/docs/src/content/docs/pt/index.mdx b/docs/src/content/docs/pt/index.mdx index a2bd9bb..1c6de9b 100644 --- a/docs/src/content/docs/pt/index.mdx +++ b/docs/src/content/docs/pt/index.mdx @@ -13,7 +13,7 @@ hero: icon: right-arrow variant: primary - text: Ir para o desafio mais recente - link: /pt/challenges/angular/44-view-transition/ + link: /pt/challenges/angular/46-simple-animations/ icon: rocket - text: Dar uma estrela link: https://github.com/tomalaforge/angular-challenges @@ -26,14 +26,15 @@ import MyIcon from '../../../components/MyIcon.astro'; import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Este repositório possui 45 Desafios relacionados a Angular, Nx, RxJS, + + Este repositório possui 46 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 349ac70..77b9f61 100644 --- a/docs/src/content/docs/ru/index.mdx +++ b/docs/src/content/docs/ru/index.mdx @@ -13,7 +13,7 @@ hero: icon: right-arrow variant: primary - text: Перейти к последней задаче - link: /ru/challenges/angular/44-view-transition/ + link: /ru/challenges/angular/46-simple-animations/ icon: rocket - text: Добавить звезду link: https://github.com/tomalaforge/angular-challenges @@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro'; import SubscriptionForm from '../../../components/SubscriptionForm.astro'; - - Этот репозиторий содержит 45 Испытания, связанных с Angular, Nx, RxJS, Ngrx and Typescript. + + Этот репозиторий содержит 46 Испытания, связанных с Angular, Nx, RxJS, Ngrx and Typescript. Испытания основаны на реальных задачах или инструментах для того, чтобы прокачать вас.