Skip to content

Commit 1d962e8

Browse files
Updating the Angular Avatar GS sample
1 parent 411a1ea commit 1d962e8

16 files changed

+390
-2
lines changed

Diff for: README.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# getting-started-with-the-angular-avatar-component
2-
A quick-start project that helps you to integrate the Syncfusion Avatar component in an Angular application. It includes a code snippet for different sizes and types of avatars. It also includes a code snippet for integrating the Avatar with the other UI components.
1+
# AngularAvatarGettingStarted
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.3.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

Diff for: angular.json

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-avatar-getting-started": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"outputPath": "dist/angular-avatar-getting-started",
17+
"index": "src/index.html",
18+
"browser": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
{
25+
"glob": "**/*",
26+
"input": "public"
27+
}
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"budgets": [
37+
{
38+
"type": "initial",
39+
"maximumWarning": "500kB",
40+
"maximumError": "1MB"
41+
},
42+
{
43+
"type": "anyComponentStyle",
44+
"maximumWarning": "2kB",
45+
"maximumError": "4kB"
46+
}
47+
],
48+
"outputHashing": "all"
49+
},
50+
"development": {
51+
"optimization": false,
52+
"extractLicenses": false,
53+
"sourceMap": true
54+
}
55+
},
56+
"defaultConfiguration": "production"
57+
},
58+
"serve": {
59+
"builder": "@angular-devkit/build-angular:dev-server",
60+
"configurations": {
61+
"production": {
62+
"buildTarget": "angular-avatar-getting-started:build:production"
63+
},
64+
"development": {
65+
"buildTarget": "angular-avatar-getting-started:build:development"
66+
}
67+
},
68+
"defaultConfiguration": "development"
69+
},
70+
"extract-i18n": {
71+
"builder": "@angular-devkit/build-angular:extract-i18n"
72+
},
73+
"test": {
74+
"builder": "@angular-devkit/build-angular:karma",
75+
"options": {
76+
"polyfills": [
77+
"zone.js",
78+
"zone.js/testing"
79+
],
80+
"tsConfig": "tsconfig.spec.json",
81+
"assets": [
82+
{
83+
"glob": "**/*",
84+
"input": "public"
85+
}
86+
],
87+
"styles": [
88+
"src/styles.css"
89+
],
90+
"scripts": []
91+
}
92+
}
93+
}
94+
}
95+
},
96+
"cli": {
97+
"analytics": false
98+
}
99+
}

Diff for: package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "angular-avatar-getting-started",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^18.2.0",
14+
"@angular/common": "^18.2.0",
15+
"@angular/compiler": "^18.2.0",
16+
"@angular/core": "^18.2.0",
17+
"@angular/forms": "^18.2.0",
18+
"@angular/platform-browser": "^18.2.0",
19+
"@angular/platform-browser-dynamic": "^18.2.0",
20+
"@angular/router": "^18.2.0",
21+
"@syncfusion/ej2-angular-layouts": "^27.1.51",
22+
"rxjs": "~7.8.0",
23+
"tslib": "^2.3.0",
24+
"zone.js": "~0.14.10"
25+
},
26+
"devDependencies": {
27+
"@angular-devkit/build-angular": "^18.2.3",
28+
"@angular/cli": "^18.2.3",
29+
"@angular/compiler-cli": "^18.2.0",
30+
"@types/jasmine": "~5.1.0",
31+
"jasmine-core": "~5.2.0",
32+
"karma": "~6.4.0",
33+
"karma-chrome-launcher": "~3.2.0",
34+
"karma-coverage": "~2.2.0",
35+
"karma-jasmine": "~5.1.0",
36+
"karma-jasmine-html-reporter": "~2.1.0",
37+
"typescript": "~5.5.2"
38+
}
39+
}

Diff for: public/favicon.ico

14.7 KB
Binary file not shown.

Diff for: src/app/app.component.css

Whitespace-only changes.

Diff for: src/app/app.component.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div class='container'>
2+
<!-- <div class="e-avatar image e-avatar-large"></div> -->
3+
<!-- <span class="e-avatar e-avatar-circle">LC</span> -->
4+
<!-- <span class="e-avatar image e-avatar-small"></span> -->
5+
6+
<!-- <span class="e-avatar e-avatar-large e-avatar-circle">LC</span> -->
7+
<div class="card-container">
8+
<div class="e-card e-custom-card">
9+
<div class="e-card-header">
10+
<div class="e-avatar image e-avatar-xlarge e-avatar-circle"></div>
11+
</div>
12+
<div class="e-card-header">
13+
<div class="e-card-header-caption center">
14+
<div class="e-card-header-title name">Will Smith</div>
15+
<div class="e-card-sub-title">Sales Coordinator</div>
16+
</div>
17+
</div>
18+
<div class="e-card-content">
19+
<p className="avatar-content">
20+
Will Smith received a BA in psychology from the University of Washington.
21+
He has also completed a course in Business French. He reads and writes French.
22+
</p>
23+
</div>
24+
</div>
25+
</div>
26+
</div>

Diff for: src/app/app.component.spec.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { AppComponent } from './app.component';
3+
4+
describe('AppComponent', () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
imports: [AppComponent],
8+
}).compileComponents();
9+
});
10+
11+
it('should create the app', () => {
12+
const fixture = TestBed.createComponent(AppComponent);
13+
const app = fixture.componentInstance;
14+
expect(app).toBeTruthy();
15+
});
16+
17+
it(`should have the 'angular-avatar-getting-started' title`, () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app.title).toEqual('angular-avatar-getting-started');
21+
});
22+
23+
it('should render title', () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
fixture.detectChanges();
26+
const compiled = fixture.nativeElement as HTMLElement;
27+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, angular-avatar-getting-started');
28+
});
29+
});

Diff for: src/app/app.component.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from '@angular/core';
2+
import { RouterOutlet } from '@angular/router';
3+
4+
@Component({
5+
selector: 'app-root',
6+
standalone: true,
7+
imports: [RouterOutlet],
8+
templateUrl: './app.component.html',
9+
styleUrl: './app.component.css'
10+
})
11+
export class AppComponent {
12+
title = 'angular-avatar-getting-started';
13+
}

Diff for: src/app/app.config.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
4+
import { routes } from './app.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
8+
};

Diff for: src/app/app.routes.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [];

Diff for: src/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>AngularAvatarGettingStarted</title>
6+
<base href="/">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
</head>
10+
<body>
11+
<app-root></app-root>
12+
</body>
13+
</html>

Diff for: src/main.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { appConfig } from './app/app.config';
3+
import { AppComponent } from './app/app.component';
4+
5+
bootstrapApplication(AppComponent, appConfig)
6+
.catch((err) => console.error(err));

Diff for: src/styles.css

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* You can add global styles to this file, and also import other style files */
2+
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
3+
@import '../node_modules/@syncfusion/ej2-layouts/styles/material.css';
4+
@import "../node_modules/@syncfusion/ej2-angular-layouts/styles/material.css";
5+
6+
/* margin: 2px; */
7+
.e-avatar.image {
8+
background-image: url(https://ej2.syncfusion.com/demos/src/grid/images/2.png);
9+
margin: 2px;
10+
}
11+
12+
/* .container {
13+
margin-left: 48%;
14+
margin-top: 7%;
15+
} */
16+
17+
.container {
18+
margin: 50px auto 0;
19+
width: 500px;
20+
height: 700px;
21+
}
22+
23+
.card-container .name {
24+
margin-top: 10px;
25+
}
26+
27+
.card-container {
28+
max-width: 300px;
29+
margin: auto;
30+
min-height: 400px;
31+
}
32+
33+
.e-custom-card {
34+
overflow: visible;
35+
margin-top: 80px;
36+
border-width: 1px;
37+
padding: 1px;
38+
}
39+
40+
.e-custom-card .e-card-header {
41+
text-align: center;
42+
padding: 0px;
43+
}
44+
45+
.e-custom-card .e-avatar {
46+
font-size: 25px;
47+
position: absolute;
48+
bottom: 160px;
49+
left: auto;
50+
box-shadow: 0 16px 28px -8px rgba(0, 0, 0, .36), 0 4px 15px 0 rgba(0, 0, 0, .12), 0 8px 10px -5px rgba(0, 0, 0, .2);
51+
}
52+
53+
.e-card.e-custom-card :nth-child(3) {
54+
padding: 10px 0px 10px 10px;
55+
}
56+
57+
.e-custom-card.e-card .e-card-content {
58+
overflow: visible;
59+
}
60+
61+
.avatar-content {
62+
text-align: center;
63+
color: rgb(94, 94, 94);
64+
}

Diff for: tsconfig.app.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3+
{
4+
"extends": "./tsconfig.json",
5+
"compilerOptions": {
6+
"outDir": "./out-tsc/app",
7+
"types": []
8+
},
9+
"files": [
10+
"src/main.ts"
11+
],
12+
"include": [
13+
"src/**/*.d.ts"
14+
]
15+
}

Diff for: tsconfig.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3+
{
4+
"compileOnSave": false,
5+
"compilerOptions": {
6+
"outDir": "./dist/out-tsc",
7+
"strict": true,
8+
"noImplicitOverride": true,
9+
"noPropertyAccessFromIndexSignature": true,
10+
"noImplicitReturns": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"skipLibCheck": true,
13+
"isolatedModules": true,
14+
"esModuleInterop": true,
15+
"sourceMap": true,
16+
"declaration": false,
17+
"experimentalDecorators": true,
18+
"moduleResolution": "bundler",
19+
"importHelpers": true,
20+
"target": "ES2022",
21+
"module": "ES2022",
22+
"lib": [
23+
"ES2022",
24+
"dom"
25+
]
26+
},
27+
"angularCompilerOptions": {
28+
"enableI18nLegacyMessageIdFormat": false,
29+
"strictInjectionParameters": true,
30+
"strictInputAccessModifiers": true,
31+
"strictTemplates": true
32+
}
33+
}

0 commit comments

Comments
 (0)