@@ -64,10 +64,25 @@ npm install design-angular-kit --save
6464Choose the version corresponding to your Angular version:
6565
6666| Angular | design-angular-kit |
67- | --------- | -------------------- |
67+ | ------- | ------------------ |
6868| 18+ | v1.1.0 + |
6969| 17+ | v1.0.0 + |
7070
71+ Alternatively, you can run the command
72+
73+ ``` sh
74+ ng add design-angular-kit --project < projectName>
75+ ```
76+
77+ He will consecutively perform:
78+
79+ - choose the correct Angular version
80+ - install the dep
81+ - add the dep to package.json
82+ - application configuration
83+
84+ The instruction of the next chapter, ** Configuration** , will be executed automatically, except for the customization of \_ i18n.
85+
7186## Configuration
7287
7388### App configuration
@@ -84,11 +99,8 @@ initialise the library's functionality.
8499import { provideDesignAngularKit } from ' design-angular-kit' ;
85100
86101export const appConfig: ApplicationConfig = {
87- providers: [
88- ...
89- provideDesignAngularKit (),
90- ]
91- }
102+ providers: [... provideDesignAngularKit ()],
103+ };
92104```
93105
94106#### Modular application
@@ -100,28 +112,21 @@ using the `forRoot` method in order to initialise the library functionality and
100112import { DesignAngularKitModule } from ' design-angular-kit' ;
101113
102114@NgModule ({
103- imports: [
104- ...
105- DesignAngularKitModule .forRoot ()
106- ]
115+ imports: [... DesignAngularKitModule .forRoot ()],
107116})
108- export class AppModule { }
117+ export class AppModule {}
109118```
110119
111120Uses the ` forChild ` method when importing the ` DesignAngularKitModule ` into other modules of the application to ** import all library components** .
112121
113-
114122``` typescript
115123import { DesignAngularKitModule } from ' design-angular-kit' ;
116124
117125@NgModule ({
118- imports: [
119- ...
120- DesignAngularKitModule .forChild ()
121- ],
126+ imports: [... DesignAngularKitModule .forChild ()],
122127 exports: [DesignAngularKitModule ],
123128})
124- export class SharedModule { }
129+ export class SharedModule {}
125130```
126131
127132#### Hybrid application
@@ -134,11 +139,9 @@ import { provideDesignAngularKit } from 'design-angular-kit';
134139
135140@NgModule ({
136141 imports: [],
137- providers: [
138- provideDesignAngularKit (),
139- ]
142+ providers: [provideDesignAngularKit ()],
140143})
141- export class AppModule { }
144+ export class AppModule {}
142145```
143146
144147#### Configuration Parameters
@@ -161,7 +164,7 @@ const initConfig: DesignAngularKitConfig | undefined = {
161164 * @default true
162165 */
163166 loadFont: boolean | undefined ,
164-
167+
165168 ...
166169};
167170
@@ -171,11 +174,12 @@ DesignAngularKitModule.forRoot(initConfig)
171174```
172175
173176### Importing bootstrap styles
177+
174178Configure the required styles in the file ` styles.scss ` . Import the SCSS library as shown in the example below.
175179
176180``` scss
177181// Importing bootstrap-italia SCSS library
178- @import " bootstrap-italia/src/scss/bootstrap-italia" ;
182+ @import ' bootstrap-italia/src/scss/bootstrap-italia' ;
179183```
180184
181185<details >
@@ -190,7 +194,6 @@ The use of blue #0066CC should, however, be reserved for the central administrat
190194State, and thus one may find oneself in the position of having to customise the values of the variables
191195colour of Bootstrap Italy, setting new values for their own needs.
192196
193-
194197This colour and the other tones are generated from the HSB triad, so the variables primary-h, primary-s and primary-b must be modified.
195198To obtain the correspondence between the hexadecimal value of the colour and HSB, one can use the rgb.to portal, e.g. https://rgb.to/0066CC .
196199
@@ -213,6 +216,7 @@ $font-family-monospace: 'Custom Font', 'Courier New', Courier, monospace;
213216// Importing bootstrap-italia SCSS library
214217@import ' bootstrap-italia/src/scss/bootstrap-italia' ;
215218```
219+
216220</details >
217221
218222### Icon and asset support
@@ -250,14 +254,14 @@ Edit your `angular.json` by adding:
250254 ]
251255}
252256```
257+
253258You can use the localised labels of the ` design-angular-kit ` library in your application, e.g. ` {{'en.errors.required-field' | translate}} ` . [ See our labels] ( projects/design-angular-kit/assets/i18n/en.json )
254259
255260#### Existing location
256261
257262If you already use localisation files in your app, you can use the library [ ngx-translate-multi-http-loader] ( https://www.npmjs.com/package/ngx-translate-multi-http-loader )
258263to load both the app's localisation files and those of the ` design-angular-kit ` library
259264
260-
261265** Using the ` provideDesignAngularKit ` function:**
262266
263267``` typescript
@@ -269,16 +273,18 @@ import { provideDesignAngularKit } from 'design-angular-kit';
269273provideDesignAngularKit ({
270274 translateLoader : (itPrefix : string , itSuffix : string ) => ({
271275 provide: TranslateLoader ,
272- useFactory : (http : HttpBackend ) => new MultiTranslateHttpLoader (http , [
273- { prefix: itPrefix , suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
274- { prefix: ' ./assets/i18n/' }, // Your i18n location
275- ]),
276- deps: [HttpBackend ]
276+ useFactory : (http : HttpBackend ) =>
277+ new MultiTranslateHttpLoader (http , [
278+ { prefix: itPrefix , suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
279+ { prefix: ' ./assets/i18n/' }, // Your i18n location
280+ ]),
281+ deps: [HttpBackend ],
277282 }),
278- })
283+ });
279284```
280285
281286** Using the ` DesignAngularKitModule ` :**
287+
282288``` typescript
283289import { HttpBackend } from ' @angular/common/http' ;
284290import { TranslateLoader } from ' @ngx-translate/core' ;
@@ -288,18 +294,20 @@ import { DesignAngularKitModule } from 'design-angular-kit';
288294DesignAngularKitModule .forRoot ({
289295 translateLoader : (itPrefix : string , itSuffix : string ) => ({
290296 provide: TranslateLoader ,
291- useFactory : (http : HttpBackend ) => new MultiTranslateHttpLoader (http , [
292- { prefix: itPrefix , suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
293- { prefix: ' ./assets/i18n/' }, // Your i18n location
294- ]),
295- deps: [HttpBackend ]
297+ useFactory : (http : HttpBackend ) =>
298+ new MultiTranslateHttpLoader (http , [
299+ { prefix: itPrefix , suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
300+ { prefix: ' ./assets/i18n/' }, // Your i18n location
301+ ]),
302+ deps: [HttpBackend ],
296303 }),
297- })
304+ });
298305```
299306
300307#### Localisation customisation
301308
302309If you want to customise our labels:
310+
303311- Do not include i18n support in your ` angular.json ` .
304312 - Create your custom location files in your ` assets/bootstrap-italia/i18n/ ` folder (create the path if it does not exist)
305313 - The json must have [ this format] ( projects/design-angular-kit/assets/i18n/en.json ) .
@@ -317,13 +325,12 @@ import { ItAlertComponent, ItPaginationComponent, ItBreadcrumbsModule } from 'de
317325
318326@NgModule ({
319327 imports: [
320- ItAlertComponent ,
321- ItPaginationComponent ,
322- ItBreadcrumbsModule // Includes ItBreadcrumbComponent and ItBreadcrumbItemComponent
328+ ItAlertComponent ,
329+ ItPaginationComponent ,
330+ ItBreadcrumbsModule , // Includes ItBreadcrumbComponent and ItBreadcrumbItemComponent
323331 ],
324332})
325- export class YourAppModule {
326- }
333+ export class YourAppModule {}
327334```
328335
329336``` typescript
@@ -333,19 +340,18 @@ import { ItAlertComponent, ItPaginationComponent, ItBreadcrumbsModule } from 'de
333340 selector: ' app-product' ,
334341 standalone: true ,
335342 imports: [ItAlertComponent , ItPaginationComponent , ItBreadcrumbsModule ],
336- templateUrl: ' ./product.component.html'
343+ templateUrl: ' ./product.component.html' ,
337344})
338- export class ProductComponent {
339- }
345+ export class ProductComponent {}
340346```
341347
342348## How to contribute 💙
343349
344350👉🏻 You can contribute to the library in various ways:
345351
346- * With your own code, taking charge of an issue among those open and not already assigned among [ the issues] ( https://github.com/italia/design-angular-kit/issues ) of Angular Kit (a comment on the issue is also sufficient to notify the willingness to take charge).
347- * By reporting bugs or improvements to the [ official repository] ( https://github.com/italia/design-angular-kit/ ) of Angular Kit.
348- * By writing to us on Slack's [ dedicated channel] ( https://developersitalia.slack.com/messages/C04H3C19D52/ ) .
352+ - With your own code, taking charge of an issue among those open and not already assigned among [ the issues] ( https://github.com/italia/design-angular-kit/issues ) of Angular Kit (a comment on the issue is also sufficient to notify the willingness to take charge).
353+ - By reporting bugs or improvements to the [ official repository] ( https://github.com/italia/design-angular-kit/ ) of Angular Kit.
354+ - By writing to us on Slack's [ dedicated channel] ( https://developersitalia.slack.com/messages/C04H3C19D52/ ) .
349355
350356## How to contribute the code
351357
@@ -438,17 +444,17 @@ npm run test
438444
439445Special thanks to those who made the development of this library possible!
440446
441- [ ![ Antonino Bonanno] ( https://github.com/AntoninoBonanno.png?size=100 )] ( https://github.com/AntoninoBonanno ) | [ ![ Cristian Borelli] ( https://github.com/cri99.png?size=100 )] ( https://github.com/cri99 ) | [ ![ Alessio Napolitano] ( https://github.com/alenap93.png?size=100 )] ( https://github.com/alenap93 ) |
442- --- | --- | --- |
443- Antonino Bonanno | Cristian Borelli | Alessio Napolitano |
447+ | [ ![ Antonino Bonanno] ( https://github.com/AntoninoBonanno.png?size=100 )] ( https://github.com/AntoninoBonanno ) | [ ![ Cristian Borelli] ( https://github.com/cri99.png?size=100 )] ( https://github.com/cri99 ) | [ ![ Alessio Napolitano] ( https://github.com/alenap93.png?size=100 )] ( https://github.com/alenap93 ) |
448+ | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- --- |
449+ | Antonino Bonanno | Cristian Borelli | Alessio Napolitano |
444450
445451and thanks to [ NetService team] ( https://www.net-serv.it/ ) :
446452
447453<a href =" https://www.net-serv.it/ " ><img src =" https://www.net-serv.it/css/internet/agid/images/svg/logo-netservicesrl.svg " alt =" NetService logo " width =" 300 " ></a >
448454
449455---
450456
451- All contributors (* made with [ contributors-img] ( https://contrib.rocks ) * )
457+ All contributors (_ made with [ contributors-img] ( https://contrib.rocks ) _ )
452458
453459<a href = " https://github.com/italia/design-angular-kit/graphs/contributors " >
454460 <img src = " https://contrib.rocks/image?repo=italia/design-angular-kit " />
0 commit comments