0.0.4 • Published 7 months ago

compass-ed-consumption-ngcomponents v0.0.4

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

Common angular components for Sunbird consumption!

Contains common UI components powered by angular. These components are designed to be used in sunbird consumption platforms (mobile app, web portal, offline desktop app) to drive reusability, maintainability hence reducing the redundant development effort significantly.

Getting Started

For help getting started with a new Angular app, check out the Angular CLI. For existing apps, follow these steps to begin using .

Step 1: Install the package

npm install @project-sunbird/common-consumption --save
npm install @project-sunbird/sb-styles --save

Step 2: Include the sb-styles and assets in angular.json

"styles": [
...
...
"./node_modules/@project-sunbird/sb-styles/assets/_styles.scss"
]

Add following under architect.build.assets

 {
    ...
    "build": {
    
    "builder": "@angular-devkit/build-angular:browser",
    
    "options": {
	    ...
	    ...

	    "assets": [
	    
		   ...
		   ...
		    
		    {
			    "glob": "**/*.*",
			    "input": "./node_modules/@project-sunbird/common-consumption/assets",
			    "output": "./assets/common-consumption"
		    }
	    
	    ],

    "styles": [
    
    ...
    
    "./node_modules/@project-sunbird/sb-styles/assets/_styles.scss"
    
    ],
    
    ...
    ...

},

Step 3: Import the modules and components

Import the NgModule for each component you want to use:

import { CommonConsumptionModule} from '@project-sunbird/common-consumption';

@NgModule({
    ...
    
    imports: [CommonConsumptionModule],
    
    ...
})


export class TestAppModule { }

Alternatively, you can create a separate NgModule that imports and then re-exports all of the Angular components that you will use in your application. By exporting them again, other modules can simply include your CustomSunbirdComponentsModule wherever components are needed, and automatically get all of the exported modules. A good place for importing/exporting the application-wide modules is the SharedModule.

import { CardsModule } from '@project-sunbird/common-consumption/card';

import { PopoverModule } from '@project-sunbird/common-consumption/popover';


@NgModule({

...

imports: [CardsModule, PopoverModule],

exports: [CardsModule, PopoverModule],

...

})


export class MyOwnCustomSunbirdComponentsModule { }

Available components

FeatureNotesSelectorCode
LibraryCardCan be used in the library page for all consumption platformssb-library-card<sb-library-card><sb-library-card>
CourseCardCan be used in the courses page for all consumption platformssb-course-card<sb-course-card><sb-course-card>
MyCourseCardCan be used in the My courses section for all consumption platformssb-my-course-card<sb-my-course-card></sb-my-course-card>
TocCardCan be used in the TOC cardsb-toc-cardNA
LibraryCardsGridCan be used in the courses page for all consumption platformssb-library-cards-grid
<sb-library-cards-grid [title]="Grid Title" [isLoading]="isLoading[maxCardCount="3"><sb-library-cards-grid>
CourseCardsGridCan be used in the course page for all consumption platformssb-course-cards-hlist
<sb-course-cards-hlist [multiRow]="true" [contentList]="range(15)"[type="'curiculum_course_card_grid'" [title]="'Courses'" [isLoading]="isLoading"><sb-course-cards-hlist>
LibraryCardsStackCan be used in the courses page for all consumption platformssb-library-cards-stack
<sb-library-cards-stack [title]="Stack Title"[contentList]="range(15)" [maxCardCount]="3" [isLoading]="isLoading"></sb-library-cards-stack>
Confirmation ModalCan be used in places where a popup is needed with user promptsb-confirmation-modal
LibraryFiltersCan be used in the library page for all consumption platforms.sb-library-filters
FAQ ComponentFaq for Consumption Clients with intractable events.sb-faq
Card hover componentCan be used with library card to add overlay on card with action items .sb-card-hover
TOCItem componentShows given array of Items with accordion structure.sb-toc-item
TOCChildItem componentShows given array of Items with accordion structure.sb-toc-item
Member Card componentMember Card With Menu.sb-member-card
<sb-member-card></sb-member-card>
Member List componentMember List With Cards.sb-member-list
<sb-member-list [layoutConfig]="{size:'medium', isBold:false, isSelectable:true,view:'horizontal'}" [memberList]="range(15)" [isMenu]="false"(cardClick)="memberCardClick`` ($event)" (menuClick)="menuClick($event)"></sb-member-list>`
Group Card component
Group Card.sb-group-card
<sb-group-card></sb-group-card>

Available directives

FeatureNotesdirectiveCode
CertificateDownloadAsImageDirectiveCan be used on any DOM element to make it download certificate as image on clicksbCertificateDownloadAsImage<button sbCertificateDownloadAsImage [template]="'<svg some-attr="$SOME_VAR"></svg>'" [metadata]="{$SOME_VAR: 'SOME_VALUE'}" [baseUrl]="'SAMPLE_BASE_URL'"></button>
CertificateDownloadAsPdfDirectiveCan be used on any DOM element to make it download certificate as PDF on clicksbCertificateDownloadAsPdf<button sbCertificateDownloadAsImage [template]="'<svg some-attr="$SOME_VAR"></svg>'" [metadata]="{$SOME_VAR: 'SOME_VALUE'}" [baseUrl]="'SAMPLE_BASE_URL'"></button>

Versions

release branchnpm package versionAngular Version
v10_migration4.11.0Ng V10
release-5.1.0_v114.12.0Ng V11
release-5.1.0_v125.1.0Ng V12
release-5.1.0_v125.1.1Ng V12
release-6.0.0_v136.0.0Ng V13