feat(doc): move pipe stuling

This commit is contained in:
thomas
2023-10-18 10:05:07 +02:00
parent a0844c8a42
commit 058c7b04a0
14 changed files with 24 additions and 18 deletions

View File

@@ -0,0 +1,36 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,13 @@
# Highly Customizable CSS
> Author: Thomas Laforge
### Run Application
```bash
npx nx serve angular-styling
```
### Documentation and Instruction
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/13-angular-styling/).

View File

@@ -0,0 +1,82 @@
{
"name": "angular-styling",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/angular/styling/src",
"prefix": "app",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/angular/styling",
"index": "apps/angular/styling/src/index.html",
"main": "apps/angular/styling/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/angular/styling/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"apps/angular/styling/src/favicon.ico",
"apps/angular/styling/src/assets"
],
"styles": ["apps/angular/styling/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "angular-styling:build:production"
},
"development": {
"browserTarget": "angular-styling:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-styling:build"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/angular/styling/**/*.ts",
"apps/angular/styling/**/*.html"
]
}
}
},
"tags": []
}

View File

@@ -0,0 +1,17 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component } from '@angular/core';
import { TextStaticComponent } from './static-text.component';
import { TextComponent } from './text.component';
@Component({
selector: 'page',
standalone: true,
imports: [TextStaticComponent, TextComponent],
template: `
<static-text></static-text>
<static-text type="error"></static-text>
<static-text type="warning"></static-text>
<text [font]="15" color="blue">This a a blue text</text>
`,
})
export class PageComponent {}

View File

@@ -0,0 +1,33 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, Input } from '@angular/core';
import { TextComponent } from './text.component';
export type StaticTextType = 'normal' | 'warning' | 'error';
@Component({
selector: 'static-text',
standalone: true,
imports: [TextComponent],
template: `
<text [font]="font" [color]="color">This is a static text</text>
`,
})
export class TextStaticComponent {
@Input() set type(type: StaticTextType) {
switch (type) {
case 'error': {
this.font = 30;
this.color = 'red';
break;
}
case 'warning': {
this.font = 25;
this.color = 'orange';
break;
}
}
}
font = 10;
color = 'black';
}

View File

@@ -0,0 +1,16 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, Input } from '@angular/core';
@Component({
selector: 'text',
standalone: true,
template: `
<p style="font-size: {{ font }}px; color: {{ color }}">
<ng-content></ng-content>
</p>
`,
})
export class TextComponent {
@Input() font = 10;
@Input() color = 'black';
}

View File

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>Styling</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>
<page></page>
</body>
</html>

View File

@@ -0,0 +1,4 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { PageComponent } from './app/page.component';
bootstrapApplication(PageComponent).catch((err) => console.error(err));

View File

@@ -0,0 +1 @@
/* You can add global styles to this file, and also import other style files */

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

View File

@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.editor.json"
}
],
"extends": "../../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}