Same as demo-app-from-scratch but only using tailwind utility classes and postCSS

This commit is contained in:
tsi 2025-05-06 18:56:35 +02:00
parent 4f95338072
commit 65473e5b08
Signed by: tosu
SSH Key Fingerprint: SHA256:12cSlRVb42jJ+Mk5F9Moq2uhJHVmIuaBoTyJTcoDS2s
44 changed files with 16197 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false
[*.md]
max_line_length = off
trim_trailing_whitespace = false

42
demo-app-tailwind/.gitignore vendored Normal file
View File

@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

View File

@ -0,0 +1,5 @@
{
"plugins": {
"@tailwindcss/postcss": {}
}
}

BIN
demo-app-tailwind/.swp Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}

20
demo-app-tailwind/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}

42
demo-app-tailwind/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}

View File

@ -0,0 +1,59 @@
# DemoAppPrimeng
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.10.
## Development server
To start a local development server, run:
```bash
ng serve
```
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the project run:
```bash
ng build
```
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

View File

@ -0,0 +1,96 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"demo-app-primeng": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/demo-app-primeng",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "demo-app-primeng:build:production"
},
"development": {
"buildTarget": "demo-app-primeng:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}

15428
demo-app-tailwind/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
{
"name": "demo-app-primeng",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/common": "^19.2.0",
"@angular/compiler": "^19.2.0",
"@angular/core": "^19.2.0",
"@angular/forms": "^19.2.0",
"@angular/platform-browser": "^19.2.0",
"@angular/platform-browser-dynamic": "^19.2.0",
"@angular/router": "^19.2.0",
"@primeng/themes": "^19.1.2",
"@tailwindcss/postcss": "^4.1.5",
"postcss": "^8.5.3",
"primeng": "^19.1.2",
"rxjs": "~7.8.0",
"tailwindcss": "^4.1.5",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^19.2.10",
"@angular/cli": "^19.2.10",
"@angular/compiler-cli": "^19.2.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.7.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,5 @@
<main class="main">
<app-header />
</main>
<router-outlet />

View File

@ -0,0 +1,29 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have the 'demo-app-primeng' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('demo-app-primeng');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, demo-app-primeng');
});
});

View File

@ -0,0 +1,13 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import {HeaderComponent} from './header/header.component';
@Component({
selector: 'app-root',
imports: [RouterOutlet, HeaderComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
title = 'demo-app-primeng';
}

View File

@ -0,0 +1,15 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config';
import Aura from '@primeng/themes/aura';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({ theme: { preset: Aura, options: { darkModeSelector: false } } }),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes)]
};

View File

@ -0,0 +1,16 @@
import { Routes } from '@angular/router';
import {HomeComponent} from './home/home.component';
import {HouseDetailsComponent} from './house-details/house-details.component';
export const routes: Routes = [
{
path: '',
component: HomeComponent,
title: 'Home Page',
},
{
path: 'details/:id',
component: HouseDetailsComponent,
title: 'House Details',
},
];

View File

@ -0,0 +1,6 @@
<a [routerLink]="['/']" class="no-underline text-gray-900">
<header class="shadow-lg flex items-center pt-4 pb-2 px-2">
<img class="logo w-10 mx-3 mr-2 pb-3" src="assets/acai.png" />
<h1 class="text-4xl">Acai Housing</h1>
</header>
</a>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderComponent } from './header.component';
describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HeaderComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import {RouterModule} from '@angular/router';
@Component({
selector: 'app-header',
imports: [RouterModule],
templateUrl: './header.component.html',
styles: [],
})
export class HeaderComponent {}

View File

@ -0,0 +1,7 @@
.search {
--p-button-padding-x: 20px;
--p-button-padding-y: 15px;
--p-button-primary-background: #0d6efd;
--p-button-primary-hover-background: #0254ce;
--p-button-primary-active-background: #01347f;
}

View File

@ -0,0 +1,10 @@
<section class="search flex items-center justify-center gap-1 p-4 w-full">
<p-floatlabel variant="in" class="max-w-[min(500px,50vw)] flex-grow w-full">
<input class="w-full" id="city-name" onkeydown="return event.key != 'Enter' ? true : !!document.querySelector('.search-button').click()" type="City Name" pInputText [(ngModel)]="value" />
<label for="city-name">City Name</label>
</p-floatlabel>
<p-button class="search-button" label="Submit" (click)="filterHouses(value)"/>
</section>
<section class="listing" class="grid grid-cols-[repeat(auto-fill,300px)] justify-around gap-3 my-5">
<app-house-ad *ngFor="let house of filteredHouses" [house]="house" />
</section>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,32 @@
import { Component, inject } from '@angular/core';
import {HouseService} from '../house.service';
import {House} from '../house';
import {HouseAdComponent} from '../house-ad/house-ad.component';
import {CommonModule} from '@angular/common';
import { InputTextModule } from 'primeng/inputtext';
import { ButtonModule } from 'primeng/button';
import {FormsModule} from '@angular/forms';
import { FloatLabelModule } from 'primeng/floatlabel';
@Component({
selector: 'app-home',
imports: [HouseAdComponent, CommonModule, InputTextModule, FormsModule, ButtonModule, FloatLabelModule],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent {
houses: House[] = [];
filteredHouses: House[] = [];
houseService = inject(HouseService);
value = '';
constructor () {
this.houses = this.houseService.getHouses();
this.filteredHouses = this.houses;
}
filterHouses(text: string) {
if (!text)
this.filteredHouses = this.houses;
else
this.filteredHouses = this.houses.filter((house) => house.location.includes(text))
}
}

View File

@ -0,0 +1,3 @@
.ad {
--image-height: 200px;
}

View File

@ -0,0 +1,13 @@
<section class="ad border border-solid border-gray-900 bg-sky-200 rounded-4xl leading-8 h-96">
<img class="w-full h-[var(--image-height)] object-cover p-0 rounded-t-4xl" src="{{ house.img }}" />
<div class="details h-[calc(100%-var(--image-height)-20px)] flex flex-col justify-between gap-y-3 p-3">
<div class="house-details">
<h1 class="text-2xl">{{ house.name }}</h1>
<div class="location-price flex justify-between">
<span class="house-location">{{ house.location }}</span>
<span class="house-price">{{ house.price }}</span>
</div>
</div>
<a class="after:content-[''] after:ml-1" [routerLink]="['/details', house.id]">To offer</a>
</div>
</section>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HouseAdComponent } from './house-ad.component';
describe('HouseAdComponent', () => {
let component: HouseAdComponent;
let fixture: ComponentFixture<HouseAdComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HouseAdComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HouseAdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,13 @@
import { Component, Input } from '@angular/core';
import {House} from '../house';
import {RouterModule} from '@angular/router';
@Component({
selector: 'app-house-ad',
imports: [RouterModule],
templateUrl: './house-ad.component.html',
styleUrl: './house-ad.component.css'
})
export class HouseAdComponent {
@Input() house !: House;
}

View File

@ -0,0 +1,3 @@
.ad {
--image-height: 500px;
}

View File

@ -0,0 +1,8 @@
<section class="ad m-3 border border-solid bg-sky-200 rounded-4xl leading-12 h-screen">
<img class="w-full h-[var(--image-height)] object-cover p-0 rounded-t-4xl" src="{{ house?.img }}" />
<div class="details h-[calc(100%-var(--image-height)-20px)] flex flex-col justify-start p-3 gap-y-3">
<h1 class="text-2xl">{{ house?.name }}</h1>
<span class="house-location">Location: {{ house?.location }}</span>
<span class="house-price">Buy for: {{ house?.price }}</span>
</div>
</section>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HouseDetailsComponent } from './house-details.component';
describe('HouseDetailsComponent', () => {
let component: HouseDetailsComponent;
let fixture: ComponentFixture<HouseDetailsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HouseDetailsComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HouseDetailsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,21 @@
import { Component, inject } from '@angular/core';
import { House } from '../house';
import {HouseService} from '../house.service';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-house-details',
imports: [],
templateUrl: './house-details.component.html',
styleUrl: './house-details.component.css'
})
export class HouseDetailsComponent {
route = inject(ActivatedRoute);
houseService = inject(HouseService);
houseId = -1;
house: House | undefined;
constructor () {
this.houseId = Number(this.route.snapshot.params['id']);
this.house = this.houseService.getHouseById(this.houseId);
}
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { HouseService } from './house.service';
describe('HouseService', () => {
let service: HouseService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HouseService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import {House} from './house';
@Injectable({
providedIn: 'root'
})
export class HouseService {
houses: House[] = [
{id: 1, price: "$ 1,414,000", location: 'Leipzig', name: 'Großes blaues Haus', img: 'https://images.pexels.com/photos/106399/pexels-photo-106399.jpeg'},
{id: 2, price: "$ 1,600,000", location: 'Berlin', name: 'Fette Villa', img: 'https://thumbs.dreamstime.com/b/beautiful-new-home-exterior-clear-evening-provides-setting-luxurious-34711767.jpg'},
{id: 3, price: "$ 1,100,000", location: 'Hannover', name: 'Gemütliches Haus mit Vorgarten', img: 'https://plus.unsplash.com/premium_photo-1689609950112-d66095626efb?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8aG9tZXxlbnwwfHwwfHx8MA%3D%3D'},
{id: 4, price: "$ 1,050,000", location: 'Stuttgart', name: 'Haus mit Wiese', img: 'https://media.istockphoto.com/id/1255835530/photo/modern-custom-suburban-home-exterior.jpg?s=612x612&w=0&k=20&c=0Dqjm3NunXjZtWVpsUvNKg2A4rK2gMvJ-827nb4AMU4='},
{id: 5, price: "$ 2,718,000", location: 'Saarland', name: 'Ganz normales Haus', img: 'https://images.pexels.com/photos/1396122/pexels-photo-1396122.jpeg?cs=srgb&dl=pexels-binyaminmellish-1396122.jpg&fm=jpg'},
{id: 6, price: "$ 980,000", location: 'Hamburg', name: 'Weißes Haus', img: 'https://maddenhomedesign.com/wp-content/uploads/2021/11/NewDarlington-Front-1300x900.jpg'},
]
constructor() { }
getHouses() {
return this.houses;
}
getHouseById(id: number) {
return this.houses.filter((house) => house.id == id)[0];
}
}

View File

@ -0,0 +1,7 @@
export interface House {
id: number;
price: string;
location: string;
name: string;
img: string;
}

View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DemoAppPrimeng</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,6 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

View File

@ -0,0 +1,21 @@
/* You can add global styles to this file, and also import other style files */
@import "tailwindcss";
@font-face {
font-family: "Acai Tech Font";
src: url('/assets/futura\ light\ bt.ttf') format("truetype");
}
* {
--primary-color: #D6EDFF;
--secondary-color: #ACD7EC;
--button-color: #0D6EFD;
--accent-color: #1C1C1C;
}
body {
font-family: "Acai Tech Font", Verdana, Tahoma;
background-color: var(--primary-color);
color: var(--accent-color);
}

View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@ -0,0 +1,27 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"isolatedModules": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022"
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}

View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}