├── .browserslistrc
├── .editorconfig
├── .gitignore
├── .prettierrc
├── LICENSE.md
├── README.md
├── angular.json
├── assets
├── ng-shimmer.png
├── ss-1.gif
└── ss-2.gif
├── e2e
├── protractor.conf.js
├── src
│ ├── app.e2e-spec.ts
│ └── app.po.ts
└── tsconfig.e2e.json
├── package-lock.json
├── package.json
├── projects
└── ng-shimmer
│ ├── README.md
│ ├── karma.conf.js
│ ├── ng-package.json
│ ├── package.json
│ ├── src
│ ├── lib
│ │ ├── shimmer.component.html
│ │ ├── shimmer.component.scss
│ │ ├── shimmer.component.spec.ts
│ │ ├── shimmer.component.ts
│ │ ├── shimmer.model.ts
│ │ ├── shimmer.module.ts
│ │ ├── shimmer.pipe.spec.ts
│ │ └── shimmer.pipe.ts
│ ├── public-api.ts
│ └── test.ts
│ ├── tsconfig.lib.json
│ ├── tsconfig.lib.prod.json
│ ├── tsconfig.spec.json
│ └── tslint.json
├── src
├── app
│ ├── app.component.html
│ ├── app.component.scss
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ └── cards
│ │ ├── food-rating
│ │ ├── food-rating.component.html
│ │ ├── food-rating.component.scss
│ │ ├── food-rating.component.spec.ts
│ │ └── food-rating.component.ts
│ │ └── user-rating
│ │ ├── user-rating.component.html
│ │ ├── user-rating.component.scss
│ │ ├── user-rating.component.spec.ts
│ │ └── user-rating.component.ts
├── assets
│ ├── .gitkeep
│ ├── food.png
│ ├── rating.png
│ ├── shimmer.gif
│ └── user.png
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main.ts
├── polyfills.ts
├── styles.scss
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 | .vscode
10 | # dependencies
11 | node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events.json
15 | speed-measure-plugin.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright 2020 Adithya Sreyaj
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
NG Shimmer - Content Placeholder
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | > Shimmer Animation for Angular Applications
13 |
14 | 
15 |
16 | Simple and easy to user Shimmer Animation placeholder for your Angular applications. An application should be having a good User Experience inorder to succeed. Smaller things like adding a shimmer animation to let the users know that something is being loaded is a great way to improve the application's UX.
17 |
18 | 
19 |
20 | 
21 |
22 | ## Features
23 |
24 | - Simple and Easy to Setup
25 | - Ease to use
26 | - CSS based super light
27 | - Zero Dependencies
28 | - Customizable
29 |
30 | ## How to Use the Component
31 |
32 | #### Install the package using the command:
33 |
34 | ```
35 | npm i @sreyaj/ng-shimmer
36 | ```
37 |
38 | #### Import the StarRatingModule into your module
39 |
40 | ```ts
41 | import { ShimmerModule } from '@sreyaj/ng-shimmer';
42 | @NgModule({
43 | ...
44 | imports: [ShimmerModule],
45 | ...
46 | })
47 | export class AppModule {}
48 | ```
49 |
50 | #### Now you can use the component inside your application
51 |
52 | ```html
53 |
54 | ```
55 |
56 | #### You can now customize it with the following attributes
57 |
58 | Eg with few options:
59 |
60 | ```html
61 |
62 | ```
63 |
64 | ## Customizations
65 |
66 | | Feature | Description | Attribute | Type | Default |
67 | | --------------------- | ------------------------------------------------------------------- | --------- | ------------------------------ | ------- |
68 | | Type Of Shimmer | You can change the appearance of the shimmer | type | 'line' or 'circle' or 'square' | 'line |
69 | | Width of the Shimmer | Shimmer width can be customized according to your need | width | string | '100%' |
70 | | Height of the Shimmer | Shimmer height can be customized according to your need | height | string | '12px' |
71 | | Animation Duration | Shimmer animation duration can be customized according to your need | duration | string | '1s' |
72 | | Rounded | Shimmer corners can be rounded of for 'line' or 'square' type | rounded | boolean | false |
73 |
74 | Feel free to open Issues and Pull Requests
75 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "angular-shimmer-effect": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {
12 | "@schematics/angular:component": {
13 | "style": "scss"
14 | }
15 | },
16 | "architect": {
17 | "build": {
18 | "builder": "@angular-devkit/build-angular:browser",
19 | "options": {
20 | "aot": true,
21 | "outputPath": "dist/angular-shimmer-effect",
22 | "index": "src/index.html",
23 | "main": "src/main.ts",
24 | "polyfills": "src/polyfills.ts",
25 | "tsConfig": "src/tsconfig.app.json",
26 | "assets": [
27 | "src/favicon.ico",
28 | "src/assets"
29 | ],
30 | "styles": [
31 | "src/styles.scss"
32 | ],
33 | "scripts": []
34 | },
35 | "configurations": {
36 | "production": {
37 | "fileReplacements": [
38 | {
39 | "replace": "src/environments/environment.ts",
40 | "with": "src/environments/environment.prod.ts"
41 | }
42 | ],
43 | "optimization": true,
44 | "outputHashing": "all",
45 | "sourceMap": false,
46 | "namedChunks": false,
47 | "aot": true,
48 | "extractLicenses": true,
49 | "vendorChunk": false,
50 | "buildOptimizer": true,
51 | "budgets": [
52 | {
53 | "type": "initial",
54 | "maximumWarning": "2mb",
55 | "maximumError": "5mb"
56 | },
57 | {
58 | "type": "anyComponentStyle",
59 | "maximumWarning": "6kb"
60 | }
61 | ]
62 | }
63 | }
64 | },
65 | "serve": {
66 | "builder": "@angular-devkit/build-angular:dev-server",
67 | "options": {
68 | "browserTarget": "angular-shimmer-effect:build"
69 | },
70 | "configurations": {
71 | "production": {
72 | "browserTarget": "angular-shimmer-effect:build:production"
73 | }
74 | }
75 | },
76 | "extract-i18n": {
77 | "builder": "@angular-devkit/build-angular:extract-i18n",
78 | "options": {
79 | "browserTarget": "angular-shimmer-effect:build"
80 | }
81 | },
82 | "test": {
83 | "builder": "@angular-devkit/build-angular:karma",
84 | "options": {
85 | "main": "src/test.ts",
86 | "polyfills": "src/polyfills.ts",
87 | "tsConfig": "src/tsconfig.spec.json",
88 | "karmaConfig": "src/karma.conf.js",
89 | "styles": [
90 | "src/styles.scss"
91 | ],
92 | "scripts": [],
93 | "assets": [
94 | "src/favicon.ico",
95 | "src/assets"
96 | ]
97 | }
98 | },
99 | "lint": {
100 | "builder": "@angular-devkit/build-angular:tslint",
101 | "options": {
102 | "tsConfig": [
103 | "src/tsconfig.app.json",
104 | "src/tsconfig.spec.json"
105 | ],
106 | "exclude": [
107 | "**/node_modules/**"
108 | ]
109 | }
110 | }
111 | }
112 | },
113 | "angular-shimmer-effect-e2e": {
114 | "root": "e2e/",
115 | "projectType": "application",
116 | "prefix": "",
117 | "architect": {
118 | "e2e": {
119 | "builder": "@angular-devkit/build-angular:protractor",
120 | "options": {
121 | "protractorConfig": "e2e/protractor.conf.js",
122 | "devServerTarget": "angular-shimmer-effect:serve"
123 | },
124 | "configurations": {
125 | "production": {
126 | "devServerTarget": "angular-shimmer-effect:serve:production"
127 | }
128 | }
129 | },
130 | "lint": {
131 | "builder": "@angular-devkit/build-angular:tslint",
132 | "options": {
133 | "tsConfig": "e2e/tsconfig.e2e.json",
134 | "exclude": [
135 | "**/node_modules/**"
136 | ]
137 | }
138 | }
139 | }
140 | },
141 | "ng-shimmer": {
142 | "root": "projects/ng-shimmer",
143 | "sourceRoot": "projects/ng-shimmer/src",
144 | "projectType": "library",
145 | "prefix": "lib",
146 | "architect": {
147 | "build": {
148 | "builder": "@angular-devkit/build-angular:ng-packagr",
149 | "options": {
150 | "tsConfig": "projects/ng-shimmer/tsconfig.lib.json",
151 | "project": "projects/ng-shimmer/ng-package.json"
152 | },
153 | "configurations": {
154 | "production": {
155 | "tsConfig": "projects/ng-shimmer/tsconfig.lib.prod.json"
156 | }
157 | }
158 | },
159 | "test": {
160 | "builder": "@angular-devkit/build-angular:karma",
161 | "options": {
162 | "main": "projects/ng-shimmer/src/test.ts",
163 | "tsConfig": "projects/ng-shimmer/tsconfig.spec.json",
164 | "karmaConfig": "projects/ng-shimmer/karma.conf.js"
165 | }
166 | },
167 | "lint": {
168 | "builder": "@angular-devkit/build-angular:tslint",
169 | "options": {
170 | "tsConfig": [
171 | "projects/ng-shimmer/tsconfig.lib.json",
172 | "projects/ng-shimmer/tsconfig.spec.json"
173 | ],
174 | "exclude": [
175 | "**/node_modules/**"
176 | ]
177 | }
178 | }
179 | }
180 | }
181 | },
182 | "defaultProject": "ng-shimmer"
183 | }
184 |
--------------------------------------------------------------------------------
/assets/ng-shimmer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/assets/ng-shimmer.png
--------------------------------------------------------------------------------
/assets/ss-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/assets/ss-1.gif
--------------------------------------------------------------------------------
/assets/ss-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/assets/ss-2.gif
--------------------------------------------------------------------------------
/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('Welcome to angular-shimmer-effect!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular-shimmer-effect",
3 | "version": "1.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build --prod",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": false,
13 | "author": {
14 | "name": "Adithya Sreyaj",
15 | "email": "adi.sreyaj@gmail.com",
16 | "url": "https://sreyaj.dev"
17 | },
18 | "repository": {
19 | "url": "https://github.com/adisreyaj/angular-shimmer-effect"
20 | },
21 | "dependencies": {
22 | "@angular/animations": "~11.0.2",
23 | "@angular/common": "~11.0.2",
24 | "@angular/compiler": "~11.0.2",
25 | "@angular/core": "~11.0.2",
26 | "@angular/forms": "~11.0.2",
27 | "@angular/platform-browser": "~11.0.2",
28 | "@angular/platform-browser-dynamic": "~11.0.2",
29 | "@angular/router": "~11.0.2",
30 | "@sreyaj/ng-star-rating": "^2.0.0",
31 | "core-js": "^2.5.4",
32 | "rxjs": "~6.6.3",
33 | "tslib": "^2.0.0",
34 | "zone.js": "~0.10.2"
35 | },
36 | "devDependencies": {
37 | "@angular-devkit/build-angular": "~0.1100.2",
38 | "@angular-devkit/core": "^11.0.2",
39 | "@angular/cli": "~11.0.2",
40 | "@angular/compiler-cli": "~11.0.2",
41 | "@angular/language-service": "~11.0.2",
42 | "@types/jasmine": "~3.6.0",
43 | "@types/jasminewd2": "~2.0.3",
44 | "@types/node": "^12.11.1",
45 | "codelyzer": "^6.0.0",
46 | "jasmine-core": "~3.6.0",
47 | "jasmine-spec-reporter": "~5.0.0",
48 | "karma": "~5.0.0",
49 | "karma-chrome-launcher": "~3.1.0",
50 | "karma-coverage-istanbul-reporter": "~3.0.2",
51 | "karma-jasmine": "~4.0.0",
52 | "karma-jasmine-html-reporter": "^1.5.0",
53 | "ng-packagr": "^11.0.0",
54 | "protractor": "~7.0.0",
55 | "ts-node": "~7.0.0",
56 | "tslint": "~6.1.0",
57 | "typescript": "~4.0.5"
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/README.md:
--------------------------------------------------------------------------------
1 | NG Shimmer - Content Placeholder
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | > Shimmer Animation for Angular Applications
13 |
14 | 
15 |
16 | Simple and easy to user Shimmer Animation placeholder for your Angular applications. An application should be having a good User Experience inorder to succeed. Smaller things like adding a shimmer animation to let the users know that something is being loaded is a great way to improve the application's UX.
17 |
18 | 
19 |
20 | 
21 |
22 | ## Features
23 |
24 | - Simple and Easy to Setup
25 | - Ease to use
26 | - CSS based super light
27 | - Zero Dependencies
28 | - Customizable
29 |
30 | ## How to Use the Component
31 |
32 | #### Install the package using the command:
33 |
34 | ```
35 | npm i @sreyaj/ng-shimmer
36 | ```
37 |
38 | #### Import the StarRatingModule into your module
39 |
40 | ```ts
41 | import { ShimmerModule } from '@sreyaj/ng-shimmer';
42 | @NgModule({
43 | ...
44 | imports: [ShimmerModule],
45 | ...
46 | })
47 | export class AppModule {}
48 | ```
49 |
50 | #### Now you can use the component inside your application
51 |
52 | ```html
53 |
54 | ```
55 |
56 | #### You can now customize it with the following attributes
57 |
58 | Eg with few options:
59 |
60 | ```html
61 |
62 | ```
63 |
64 | ## Customizations
65 |
66 | | Feature | Description | Attribute | Type | Default |
67 | | --------------------- | ------------------------------------------------------------------- | --------- | ------------------------------ | ------- |
68 | | Type Of Shimmer | You can change the appearance of the shimmer | type | 'line' or 'circle' or 'square' | 'line |
69 | | Width of the Shimmer | Shimmer width can be customized according to your need | width | string | '100%' |
70 | | Height of the Shimmer | Shimmer height can be customized according to your need | height | string | '12px' |
71 | | Animation Duration | Shimmer animation duration can be customized according to your need | duration | string | '1s' |
72 | | Rounded | Shimmer corners can be rounded of for 'line' or 'square' type | rounded | boolean | false |
73 |
74 | Feel free to open Issues and Pull Requests
75 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/ng-shimmer'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/ng-shimmer",
4 | "lib": {
5 | "entryFile": "src/public-api.ts"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@sreyaj/ng-shimmer",
3 | "author": {
4 | "name": "Adithya Sreyaj",
5 | "email": "adi.sreyaj@gmail.com",
6 | "url": "https://sreyaj.dev"
7 | },
8 | "description": "Shimmer Placeholder for Angular Applications. Improve the User Experience on your application by using shimmer placeholders which was made popular by Facebook",
9 | "keywords": [
10 | "angular",
11 | "shimmer",
12 | "shimmer animation",
13 | "angular shimmer",
14 | "facebook shimmer"
15 | ],
16 | "license": "Apache License 2.0",
17 | "bugs": {
18 | "url": "https://github.com/adisreyaj/angular-shimmer-effect/issues"
19 | },
20 | "homepage": "https://github.com/adisreyaj/angular-shimmer-effect/",
21 | "version": "1.0.0",
22 | "dependencies": {
23 | "tslib": "^2.0.0"
24 | },
25 | "peerDependencies": {
26 | "@angular/common": ">=9.0.0",
27 | "@angular/core": ">=9.0.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.component.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.component.scss:
--------------------------------------------------------------------------------
1 | .shimmer-loader {
2 | background: #f6f7f8;
3 | background-image: linear-gradient(
4 | to right,
5 | #f6f7f8 0%,
6 | #edeef1 20%,
7 | #f6f7f8 40%,
8 | #f6f7f8 100%
9 | );
10 | background-repeat: no-repeat;
11 | background-size: 1000px 1000px;
12 | display: inline-block;
13 | position: relative;
14 | // animation-duration: 1s;
15 | animation-fill-mode: forwards;
16 | animation-iteration-count: infinite;
17 | animation-name: shimmerAnimation;
18 | animation-timing-function: linear;
19 | // -webkit-animation-duration: 1s;
20 | -webkit-animation-fill-mode: forwards;
21 | -webkit-animation-iteration-count: infinite;
22 | -webkit-animation-name: shimmerAnimation;
23 | -webkit-animation-timing-function: linear;
24 | }
25 |
26 | @keyframes shimmerAnimation {
27 | 0% {
28 | background-position: -1000px 0;
29 | }
30 |
31 | 100% {
32 | background-position: 1000px 0;
33 | }
34 | }
35 | @-webkit-keyframes shimmerAnimation {
36 | 0% {
37 | background-position: -1000px 0;
38 | }
39 |
40 | 100% {
41 | background-position: 1000px 0;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2 |
3 | import { ShimmerComponent } from './shimmer.component';
4 |
5 | describe('NgShimmerComponent', () => {
6 | let component: ShimmerComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(waitForAsync(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ShimmerComponent],
12 | }).compileComponents();
13 | }));
14 |
15 | beforeEach(() => {
16 | fixture = TestBed.createComponent(ShimmerComponent);
17 | component = fixture.componentInstance;
18 | fixture.detectChanges();
19 | });
20 |
21 | it('should create', () => {
22 | expect(component).toBeTruthy();
23 | });
24 |
25 | it('getHeight() should return the width if type is circle or square', () => {
26 | component.type = 'square';
27 | component.width = '100px';
28 | component.height = '25px';
29 | fixture.detectChanges();
30 | expect(component.getHeight()).toBe('100px');
31 | });
32 | it('getHeight() should return the height if its not circle or square', () => {
33 | component.type = 'line';
34 | component.width = '100px';
35 | component.height = '25px';
36 | fixture.detectChanges();
37 | expect(component.getHeight()).toBe('25px');
38 | });
39 | it('getBorderRadius() should return the Border Radius', () => {
40 | component.type = 'line';
41 | component.rounded = true;
42 | fixture.detectChanges();
43 | expect(component.getBorderRadius()).toBe('3em');
44 | component.type = 'circle';
45 | fixture.detectChanges();
46 | expect(component.getBorderRadius()).toBe('50%');
47 | component.type = 'line';
48 | component.rounded = false;
49 | fixture.detectChanges();
50 | expect(component.getBorderRadius()).toBe('0px');
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
2 | import { ShimmerTypes } from './shimmer.model';
3 |
4 | @Component({
5 | selector: 'shimmer',
6 | templateUrl: './shimmer.component.html',
7 | styleUrls: ['./shimmer.component.scss'],
8 | changeDetection: ChangeDetectionStrategy.OnPush,
9 | })
10 | export class ShimmerComponent {
11 | @Input() type: ShimmerTypes = ShimmerTypes.LINE;
12 | @Input() width = '100%';
13 | @Input() height = '12px';
14 | @Input() duration = '1s';
15 | @Input() rounded = false;
16 | }
17 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.model.ts:
--------------------------------------------------------------------------------
1 | export enum ShimmerTypes {
2 | LINE = 'line',
3 | SQUARE = 'square',
4 | CIRCLE = 'circle',
5 | }
6 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { ShimmerComponent } from './shimmer.component';
3 | import { CommonModule } from '@angular/common';
4 | import { ShimmerBorderRadiusPipe, ShimmerHeightPipe } from "./shimmer.pipe";
5 |
6 | @NgModule({
7 | declarations: [ShimmerComponent, ShimmerBorderRadiusPipe, ShimmerHeightPipe],
8 | imports: [CommonModule],
9 | exports: [ShimmerComponent],
10 | })
11 | export class ShimmerModule {}
12 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.pipe.spec.ts:
--------------------------------------------------------------------------------
1 | import { ShimmerBorderRadiusPipe, ShimmerHeightPipe } from './shimmer.pipe';
2 |
3 | describe('ShimmerBorderRadiusPipe', () => {
4 | it('create an instance', () => {
5 | const pipe = new ShimmerBorderRadiusPipe();
6 | expect(pipe).toBeTruthy();
7 | });
8 | });
9 |
10 | describe('ShimmerHeightPipe', () => {
11 | it('create an instance', () => {
12 | const pipe = new ShimmerHeightPipe();
13 | expect(pipe).toBeTruthy();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/lib/shimmer.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { ShimmerTypes } from './shimmer.model';
3 |
4 | @Pipe({
5 | name: 'shimmerHeight',
6 | })
7 | export class ShimmerHeightPipe implements PipeTransform {
8 | transform(type: ShimmerTypes, width: string, height: string): string {
9 | if ([ShimmerTypes.CIRCLE, ShimmerTypes.SQUARE].includes(type)) {
10 | return width;
11 | } else {
12 | return height;
13 | }
14 | }
15 | }
16 | @Pipe({
17 | name: 'shimmerBorderRadius',
18 | })
19 | export class ShimmerBorderRadiusPipe implements PipeTransform {
20 | transform(type: ShimmerTypes, rounded = false): string {
21 | if (rounded) {
22 | return '3rem';
23 | } else {
24 | switch (type) {
25 | case ShimmerTypes.CIRCLE:
26 | return '50%';
27 | case ShimmerTypes.SQUARE:
28 | return '0px';
29 | default:
30 | return '0px';
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/public-api.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Public API Surface of ng-shimmer
3 | */
4 | export * from './lib/shimmer.module';
5 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'core-js/es7/reflect';
4 | import 'zone.js/dist/zone';
5 | import 'zone.js/dist/zone-testing';
6 | import { getTestBed } from '@angular/core/testing';
7 | import {
8 | BrowserDynamicTestingModule,
9 | platformBrowserDynamicTesting
10 | } from '@angular/platform-browser-dynamic/testing';
11 |
12 | declare const require: any;
13 |
14 | // First, initialize the Angular testing environment.
15 | getTestBed().initTestEnvironment(
16 | BrowserDynamicTestingModule,
17 | platformBrowserDynamicTesting()
18 | );
19 | // Then we find all the tests.
20 | const context = require.context('./', true, /\.spec\.ts$/);
21 | // And load the modules.
22 | context.keys().map(context);
23 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/lib",
5 | "declarationMap": true,
6 | "target": "es2015",
7 | "module": "es2015",
8 | "moduleResolution": "node",
9 | "declaration": true,
10 | "sourceMap": true,
11 | "inlineSources": true,
12 | "emitDecoratorMetadata": true,
13 | "experimentalDecorators": true,
14 | "importHelpers": true,
15 | "types": [],
16 | "lib": [
17 | "dom",
18 | "es2018"
19 | ]
20 | },
21 | "angularCompilerOptions": {
22 | "skipTemplateCodegen": true,
23 | "strictMetadataEmit": true,
24 | "fullTemplateTypeCheck": true,
25 | "strictInjectionParameters": true,
26 | "enableResourceInlining": true
27 | },
28 | "exclude": [
29 | "src/test.ts",
30 | "**/*.spec.ts"
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "compilerOptions": {
4 | "declarationMap": false
5 | },
6 | "angularCompilerOptions": {
7 | "enableIvy": false
8 | }
9 | }
--------------------------------------------------------------------------------
/projects/ng-shimmer/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts"
12 | ],
13 | "include": [
14 | "**/*.spec.ts",
15 | "**/*.d.ts"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/projects/ng-shimmer/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [true, "attribute", "lib", "camelCase"],
5 | "component-selector": [true, "element", "kebab-case"]
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 | main {
2 | padding: 32px;
3 | section {
4 | width: 100%;
5 | }
6 | .showcase {
7 | display: flex;
8 | padding: 64px 0;
9 | justify-content: space-around;
10 | div {
11 | background-color: #fff;
12 | padding: 16px 32px;
13 | border-radius: 8px;
14 | box-shadow: 0 0px 12px -6px rgba($color: #000000, $alpha: 0.25);
15 |
16 | display: flex;
17 | flex-direction: column;
18 | align-items: center;
19 | p {
20 | font-weight: 500;
21 | }
22 | }
23 | }
24 | .examples {
25 | display: flex;
26 | flex-direction: column;
27 | align-items: center;
28 | }
29 | }
30 | @media screen and (max-width: 600px) {
31 | main {
32 | padding: 8px;
33 | .showcase {
34 | flex-direction: column;
35 | div {
36 | margin-bottom: 16px;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, waitForAsync } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(waitForAsync(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'angular-shimmer-effect'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('angular-shimmer-effect');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to angular-shimmer-effect!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.scss']
7 | })
8 | export class AppComponent {
9 | title = 'angular-shimmer-effect';
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { UserRatingComponent } from './cards/user-rating/user-rating.component';
6 | import { FoodRatingComponent } from './cards/food-rating/food-rating.component';
7 | import { StarRatingModule } from '@sreyaj/ng-star-rating';
8 | import { ShimmerModule } from 'projects/ng-shimmer/src/public-api';
9 |
10 | @NgModule({
11 | declarations: [AppComponent, UserRatingComponent, FoodRatingComponent],
12 | imports: [BrowserModule, ShimmerModule, StarRatingModule],
13 | providers: [],
14 | bootstrap: [AppComponent],
15 | })
16 | export class AppModule {}
17 |
--------------------------------------------------------------------------------
/src/app/cards/food-rating/food-rating.component.html:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/src/app/cards/food-rating/food-rating.component.scss:
--------------------------------------------------------------------------------
1 | .card {
2 | height: 200px;
3 | max-width: 600px;
4 | width: 80%;
5 | min-width: 550px;
6 | background-color: #fff;
7 | border-radius: 8px;
8 | display: flex;
9 | box-shadow: 0 4px 25px -10px rgba($color: #000000, $alpha: 0.25);
10 | .image {
11 | border-radius: 8px 0 0 8px;
12 | flex: 1 0 40%;
13 | position: relative;
14 | background-image: url(../../../assets/food.png);
15 | background-repeat: no-repeat;
16 | background-position: center;
17 | background-size: cover;
18 | .current-rating {
19 | position: absolute;
20 | bottom: 6px;
21 | left: 6px;
22 | padding: 4px 8px;
23 | background-color: #fff;
24 | border-radius: 3rem;
25 | margin-top: -16px;
26 | display: flex;
27 | span {
28 | &:nth-of-type(1) {
29 | font-size: 14px;
30 | }
31 | &:nth-of-type(2) {
32 | font-size: 17px;
33 | color: #ffdd03;
34 | }
35 | }
36 | }
37 | }
38 | .meta-info {
39 | flex: 1 0 60%;
40 | padding: 16px;
41 | position: relative;
42 | box-sizing: border-box;
43 | h3 {
44 | font-size: 18px;
45 | margin-bottom: 10px;
46 | margin-top: 0;
47 | }
48 | p {
49 | margin: 6px 0;
50 | font-weight: 500;
51 | font-size: 14px;
52 | }
53 | .rating-bar {
54 | padding: 10px 0;
55 | }
56 | .chips-list {
57 | margin-top: 12px;
58 | display: flex;
59 | span {
60 | width: 30%;
61 | margin: 6px;
62 | }
63 | }
64 | }
65 | }
66 |
67 | @media screen and (max-width: 768px) {
68 | .card {
69 | height: 400px;
70 | max-width: 500px;
71 | min-width: 300px;
72 | flex-direction: column;
73 | width: 100%;
74 | .meta-info {
75 | flex: 100%;
76 | }
77 | .image {
78 | border-radius: 8px 8px 0 0;
79 | flex: 100%;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/app/cards/food-rating/food-rating.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2 |
3 | import { FoodRatingComponent } from './food-rating.component';
4 |
5 | describe('FoodRatingComponent', () => {
6 | let component: FoodRatingComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(waitForAsync(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ FoodRatingComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(FoodRatingComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/cards/food-rating/food-rating.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-food-rating',
5 | templateUrl: './food-rating.component.html',
6 | styleUrls: ['./food-rating.component.scss'],
7 | })
8 | export class FoodRatingComponent implements OnInit {
9 | rating = 5;
10 | constructor() {}
11 |
12 | ngOnInit() {}
13 | }
14 |
--------------------------------------------------------------------------------
/src/app/cards/user-rating/user-rating.component.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/src/app/cards/user-rating/user-rating.component.scss:
--------------------------------------------------------------------------------
1 | $primary: #00749F;
2 | .card{
3 | max-width: 280px;
4 | width: 80%;
5 | padding:32px 24px;
6 | background-color: #fff;
7 | border-radius: 8px;
8 | box-shadow: 0 4px 25px -10px rgba($color: #000000, $alpha: 0.25);
9 | .card-header{
10 | h3{
11 | margin-top: 0;
12 | margin-bottom: 6px;
13 | color: $primary;
14 | }
15 | p{
16 | font-size: 14px;
17 | color: #535353;
18 | }
19 | }
20 | .card-content{
21 | padding-top: 16px;
22 | text-align: center;
23 | .meta-info{
24 | display: flex;
25 | flex-flow: column wrap;
26 | align-items: center;
27 | img{
28 | height: 150px;
29 | }
30 |
31 | .name{
32 | font-weight: bold;
33 | margin-bottom: 4px;
34 | }
35 | .designation{
36 | margin-top: 0;
37 | color: #535353;
38 | font-size: 13px;
39 | }
40 |
41 | .current-rating{
42 | padding:4px 12px;
43 | background-color: #fff;
44 | border-radius: 3rem;
45 | margin-top: -16px;
46 | display: flex;
47 | span{
48 | &:nth-of-type(1){
49 | font-size: 14px;
50 | }
51 | &:nth-of-type(2){
52 | font-size: 17px;
53 | color: #3db700;
54 | }
55 | }
56 | }
57 | }
58 | .rating{
59 | padding: 6px 0;
60 | }
61 | }
62 | .card-footer{
63 | margin-top: 24px;
64 | text-align: center;
65 | button{
66 | cursor: pointer;
67 | background-color: $primary;
68 | padding: 12px 32px;
69 | border-radius: 3rem;
70 | border: none;
71 | color: #fff;
72 | }
73 | }
74 | }
75 | @media screen and (max-width: 768px){
76 | .card{
77 | width: 100%;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/app/cards/user-rating/user-rating.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2 |
3 | import { UserRatingComponent } from './user-rating.component';
4 |
5 | describe('UserRatingComponent', () => {
6 | let component: UserRatingComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(waitForAsync(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ UserRatingComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(UserRatingComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/cards/user-rating/user-rating.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-user-rating',
5 | templateUrl: './user-rating.component.html',
6 | styleUrls: ['./user-rating.component.scss']
7 | })
8 | export class UserRatingComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/food.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/assets/food.png
--------------------------------------------------------------------------------
/src/assets/rating.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/assets/rating.png
--------------------------------------------------------------------------------
/src/assets/shimmer.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/assets/shimmer.gif
--------------------------------------------------------------------------------
/src/assets/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/assets/user.png
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adisreyaj/angular-shimmer-effect/e8f57ed3ecbeb263a8fc4919f6fe4a73169c87a9/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | AngularShimmerEffect
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage/angular-shimmer-effect'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/src/styles.scss:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | margin: 0;
4 | padding: 0;
5 | font-family: 'Montserrat', sans-serif;
6 | }
7 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "main.ts",
9 | "polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "downlevelIteration": true,
6 | "outDir": "./dist/out-tsc",
7 | "sourceMap": true,
8 | "declaration": false,
9 | "module": "es2020",
10 | "moduleResolution": "node",
11 | "emitDecoratorMetadata": true,
12 | "experimentalDecorators": true,
13 | "importHelpers": true,
14 | "target": "es2015",
15 | "typeRoots": ["node_modules/@types"],
16 | "lib": ["es2018", "dom"],
17 | "paths": {
18 | "ng-shimmer": ["dist/ng-shimmer"],
19 | "ng-shimmer/*": ["dist/ng-shimmer/*"]
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rulesDirectory": [
4 | "codelyzer"
5 | ],
6 | "rules": {
7 | "align": {
8 | "options": [
9 | "parameters",
10 | "statements"
11 | ]
12 | },
13 | "array-type": false,
14 | "arrow-parens": false,
15 | "arrow-return-shorthand": true,
16 | "deprecation": {
17 | "severity": "warn"
18 | },
19 | "curly": true,
20 | "import-blacklist": [
21 | true,
22 | "rxjs/Rx"
23 | ],
24 | "interface-name": false,
25 | "eofline": true,
26 | "max-classes-per-file": false,
27 | "import-spacing": true,
28 | "indent": {
29 | "options": [
30 | "spaces"
31 | ]
32 | },
33 | "max-line-length": [
34 | true,
35 | 140
36 | ],
37 | "member-access": false,
38 | "member-ordering": [
39 | true,
40 | {
41 | "order": [
42 | "static-field",
43 | "instance-field",
44 | "static-method",
45 | "instance-method"
46 | ]
47 | }
48 | ],
49 | "no-consecutive-blank-lines": false,
50 | "no-console": [
51 | true,
52 | "debug",
53 | "info",
54 | "time",
55 | "timeEnd",
56 | "trace"
57 | ],
58 | "no-empty": false,
59 | "no-inferrable-types": [
60 | true,
61 | "ignore-params"
62 | ],
63 | "no-non-null-assertion": true,
64 | "no-redundant-jsdoc": true,
65 | "no-switch-case-fall-through": true,
66 | "no-var-requires": false,
67 | "object-literal-key-quotes": [
68 | true,
69 | "as-needed"
70 | ],
71 | "object-literal-sort-keys": false,
72 | "ordered-imports": false,
73 | "quotemark": [
74 | true,
75 | "single"
76 | ],
77 | "trailing-comma": false,
78 | "no-output-on-prefix": true,
79 | "no-inputs-metadata-property": true,
80 | "no-outputs-metadata-property": true,
81 | "no-host-metadata-property": true,
82 | "no-input-rename": true,
83 | "no-output-rename": true,
84 | "use-lifecycle-interface": true,
85 | "semicolon": {
86 | "options": [
87 | "always"
88 | ]
89 | },
90 | "space-before-function-paren": {
91 | "options": {
92 | "anonymous": "never",
93 | "asyncArrow": "always",
94 | "constructor": "never",
95 | "method": "never",
96 | "named": "never"
97 | }
98 | },
99 | "use-pipe-transform-interface": true,
100 | "typedef-whitespace": {
101 | "options": [
102 | {
103 | "call-signature": "nospace",
104 | "index-signature": "nospace",
105 | "parameter": "nospace",
106 | "property-declaration": "nospace",
107 | "variable-declaration": "nospace"
108 | },
109 | {
110 | "call-signature": "onespace",
111 | "index-signature": "onespace",
112 | "parameter": "onespace",
113 | "property-declaration": "onespace",
114 | "variable-declaration": "onespace"
115 | }
116 | ]
117 | },
118 | "component-class-suffix": true,
119 | "directive-class-suffix": true,
120 | "variable-name": {
121 | "options": [
122 | "ban-keywords",
123 | "check-format",
124 | "allow-pascal-case"
125 | ]
126 | },
127 | "whitespace": {
128 | "options": [
129 | "check-branch",
130 | "check-decl",
131 | "check-operator",
132 | "check-separator",
133 | "check-type",
134 | "check-typecast"
135 | ]
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------