feat: challenge 45 Simple Animations

This commit is contained in:
Sven Brodny
2024-02-19 23:39:09 +01:00
parent f52afb49f2
commit 649eb847be
27 changed files with 431 additions and 42 deletions

View File

@@ -24,7 +24,7 @@ If you would like to propose a challenge, this project is open source, so feel f
## Challenges ## Challenges
Check [all 44 challenges](https://angular-challenges.vercel.app/) Check [all 45 challenges](https://angular-challenges.vercel.app/)
## Contributors ✨ ## Contributors ✨

View 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": {}
}
]
}

View File

@@ -0,0 +1,13 @@
# Simple Animations
> author: thomas-laforge
### Run Application
```bash
npx nx serve angular-simple-animations
```
### Documentation and Instruction
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/45-simple-animations/).

View File

@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'angular-simple-animations',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/apps/angular/simple-animations',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/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',
],
};

View File

@@ -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"
}
}
}
}

View File

@@ -0,0 +1,8 @@
import { render } from '@testing-library/angular';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
test('...', async () => {
await render(AppComponent);
});
});

View File

@@ -0,0 +1,78 @@
import { Component } from '@angular/core';
@Component({
standalone: true,
imports: [],
selector: 'app-root',
template: `
<div class="mx-20 my-40 flex gap-5">
<div class="flex flex-1 flex-col gap-5">
<section>
<h4 class="subtitle">2008</h4>
<p>
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.
</p>
</section>
<section>
<h4 class="subtitle">2010</h4>
<p>
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.
</p>
</section>
<section>
<h4 class="subtitle">2012</h4>
<p>
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.
</p>
</section>
</div>
<div class="flex flex-1 flex-col gap-5">
<div class="flex flex-col gap-3">
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">Name:</div>
<div class="value flex-1">Samuel</div>
</div>
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">Age:</div>
<div class="value flex-1">28</div>
</div>
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">Birthdate:</div>
<div class="value flex-1">02.11.1995</div>
</div>
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">City:</div>
<div class="value flex-1">Berlin</div>
</div>
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">Language:</div>
<div class="value flex-1">English</div>
</div>
<div class="flex flex-col border-b px-5 pb-2 lg:flex-row">
<div class="key flex-1">Like Pizza:</div>
<div class="value flex-1">Hell yeah</div>
</div>
</div>
</div>
</div>
`,
styles: [''],
})
export class AppComponent {}

View File

@@ -0,0 +1,5 @@
import { ApplicationConfig } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [],
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>angular-simple-animations</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>

View 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),
);

View 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 */

View File

@@ -0,0 +1,2 @@
import '@testing-library/jest-dom';
import 'jest-preset-angular/setup-jest';

View File

@@ -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: [],
};

View 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"]
}

View File

@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"types": ["jest", "node"]
}
}

View File

@@ -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,
},
}

View File

@@ -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"
]
}

View File

@@ -1,6 +1,6 @@
{ {
"total": 44, "total": 45,
"🟢": 16, "🟢": 17,
"🟠": 120, "🟠": 120,
"🔴": 208 "🔴": 208
} }

View File

@@ -6,7 +6,6 @@ challengeNumber: 44
command: angular-view-transition command: angular-view-transition
sidebar: sidebar:
order: 208 order: 208
badge: New
--- ---
## Information ## Information

View File

@@ -0,0 +1,38 @@
---
title: 🟢 Simple Animations
description: Challenge 45 is about learning angular's integrated animation API
author: sven-brodny
challengeNumber: 45
command: angular-simple-animations
sidebar:
order: 17
badge: New
---
## Information
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 to 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.
## Constraints
Don't use any css and utilize angular's integrated `@angular/animations` api.
### 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

View File

@@ -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/angular/43-signal-input/ link: /es/challenges/angular/45-simple-animations/
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
@@ -23,16 +23,16 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../../components/MyIcon.astro'; import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro' import SubscriptionForm from '../../../components/SubscriptionForm.astro';
<CardGrid> <CardGrid>
<Card title="44 Desafíos"> <Card title="45 Desafíos">
Este repositorio contiene 44 desafíos relacionados con <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> y <b>Typescript</b>. Este repositorio contiene 45 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>
<Card title="Suscríbete para ser notificado sobre los últimos retos"> <Card title="Suscríbete para ser notificado sobre los últimos retos">
<SubscriptionForm isNote={false} lang="es"/> <SubscriptionForm isNote={false} lang="es" />
</Card> </Card>
<Card title="Conviértete en un Contribuidor de OSS"> <Card title="Conviértete en un Contribuidor de OSS">
@@ -57,7 +57,8 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro'
</Card> </Card>
<Card title="Prepárate para Entrevistas"> <Card title="Prepárate para Entrevistas">
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.
</Card> </Card>
<Card title="Patrocinio"> <Card title="Patrocinio">

View File

@@ -15,7 +15,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/angular/44-view-transition/ link: /fr/challenges/angular/45-simple-animations/
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
@@ -25,15 +25,15 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../../components/MyIcon.astro'; import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro' import SubscriptionForm from '../../../components/SubscriptionForm.astro';
<CardGrid> <CardGrid>
<Card title="44 Défis"> <Card title="45 Défis">
Ce répertoire rassemble 44 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 45 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">
<SubscriptionForm isNote={false} lang="fr"/> <SubscriptionForm isNote={false} lang="fr" />
</Card> </Card>
<Card title="Devenir un Mainteneur OSS"> <Card title="Devenir un Mainteneur OSS">

View File

@@ -24,17 +24,16 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../components/MyIcon.astro'; import MyIcon from '../../components/MyIcon.astro';
import SubscriptionForm from '../../components/SubscriptionForm.astro' import SubscriptionForm from '../../components/SubscriptionForm.astro';
<CardGrid> <CardGrid>
<Card title="44 Challenges"> <Card title="45 Challenges">
This repository gathers 44 Challenges related to <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> and <b>Typescript</b>. This repository gathers 45 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>
<Card title="Subscribe to get notify of latest challenges"> <Card title="Subscribe to get notify of latest challenges">
<SubscriptionForm isNote={false}/> <SubscriptionForm isNote={false} />
</Card> </Card>
<Card title="Become an OSS Maintainer"> <Card title="Become an OSS Maintainer">

View File

@@ -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/angular/44-view-transition/ link: /pt/challenges/angular/45-simple-animations/
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
@@ -23,19 +23,20 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../../components/MyIcon.astro'; import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro' import SubscriptionForm from '../../../components/SubscriptionForm.astro';
<CardGrid> <CardGrid>
<Card title="44 Desafios"> <Card title="45 Desafios">
Este repositório possui 44 desafios relacionados a <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, Este repositório possui 45 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.
</Card> </Card>
<Card title="Inscreva-se para ser notificado do desafio mais recente"> {' '}
<SubscriptionForm isNote={false} lang="pt"/> <Card title="Inscreva-se para ser notificado do desafio mais recente">
</Card> <SubscriptionForm isNote={false} lang="pt" />
</Card>
{' '} {' '}

View File

@@ -13,7 +13,7 @@ hero:
icon: right-arrow icon: right-arrow
variant: primary variant: primary
- text: Перейти к последней задаче - text: Перейти к последней задаче
link: /ru/challenges/angular/44-view-transition/ link: /ru/challenges/angular/45-simple-animations/
icon: rocket icon: rocket
- text: Добавить звезду - text: Добавить звезду
link: https://github.com/tomalaforge/angular-challenges link: https://github.com/tomalaforge/angular-challenges
@@ -23,36 +23,38 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components'; import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../../components/MyIcon.astro'; import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro' import SubscriptionForm from '../../../components/SubscriptionForm.astro';
<CardGrid> <CardGrid>
<Card title="44 Испытания"> <Card title="45 Испытания">
Этот репозиторий содержит 44 испытания, связанных с <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> and <b>Typescript</b>. Этот репозиторий содержит 45 Испытания, связанных с <b>Angular</b>, <b>Nx</b>, <b>RxJS</b>, <b>Ngrx</b> and <b>Typescript</b>.
Испытания основаны на реальных задачах или инструментах для того, чтобы прокачать вас. Испытания основаны на реальных задачах или инструментах для того, чтобы прокачать вас.
</Card> </Card>
<Card title="Subscribe to get notify of latest challenges"> <Card title="Subscribe to get notify of latest challenges">
<SubscriptionForm isNote={false} lang="ru"/> <SubscriptionForm isNote={false} lang="ru" />
</Card> </Card>
<Card title="Станьте мейнтейнером открытого программного обеспечения (OSS)"> <Card title="Станьте мейнтейнером открытого программного обеспечения (OSS)">
Одна из целей этого репозитория <b>снизить барьер</b> для разработки Одна из целей этого репозитория <b>снизить барьер</b> для разработки открытого
открытого программного обеспечения (OSS). Решив эти задачи, вы поймете, программного обеспечения (OSS). Решив эти задачи, вы поймете, как начать
как начать вносить свой вклад в любой другой проект с открытым исходным кодом. вносить свой вклад в любой другой проект с открытым исходным кодом.
</Card> </Card>
<Card title="Учитесь вместе с другими"> <Card title="Учитесь вместе с другими">
Изучение и использование нового фреймворка всегда сопряжено с трудностями. Изучение и использование нового фреймворка всегда сопряжено с трудностями. В
В этом наборе испытаний содержатся реальные примеры задач, чтобы закрепить на практике то, чему вы научились. этом наборе испытаний содержатся реальные примеры задач, чтобы закрепить на
Любой может оставить комментарий или предложить помощь. практике то, чему вы научились. Любой может оставить комментарий или
предложить помощь.
<b> <b>
Учиться одному - здорово, но обучение вместе с другими поможет вам добиться большего. Учиться одному - здорово, но обучение вместе с другими поможет вам добиться
большего.
</b> </b>
</Card> </Card>
<Card title="Вносите свой вклад"> <Card title="Вносите свой вклад">
У вас есть идея или интересный баг? Не стесняйтесь;{' '} У вас есть идея или интересный баг? Не стесняйтесь;{' '}
<b>Создавайте свои собственные испытания</b> не теряя времени. <b>Создавайте свои собственные испытания</b> не теряя времени.
</Card> </Card>
<Card title="Подготовьтесь к собеседованию"> <Card title="Подготовьтесь к собеседованию">
@@ -61,8 +63,9 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro'
</Card> </Card>
<Card title="Поддержка"> <Card title="Поддержка">
Это бесплатный проект, и он будет оставаться таковым как можно дольше. Это бесплатный проект, и он будет оставаться таковым как можно дольше. Однако
Однако вся работа ведется в мое свободное время, включая создание новых испытаний и ревью их решений(PRs). вся работа ведется в мое свободное время, включая создание новых испытаний и
ревью их решений(PRs).
<b>Спонсорство может поддержать меня и способствовать развитию проекта</b>. <b>Спонсорство может поддержать меня и способствовать развитию проекта</b>.
</Card> </Card>