feature(ui-library): Added own library of UI components to replace digi-ng. Skeleton is first component moved (TV-850)
Squashed commit of the following: commit d76e32cd99e2e823142f4410e66c66df5e096041 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Thu Oct 28 10:28:02 2021 +0200 Move styles to own library commit 85f0a5788ebdd7309499b1b623f4ac1046f45811 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Thu Oct 28 10:09:23 2021 +0200 double quotes in html commit eeb600cd631e3478c136795a8109e8927546b14b Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 27 16:42:48 2021 +0200 UI library with copy of digi-ng's skeleton commit 11a24c0eef173e6b2f087eca5e96063036e6394b Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 27 16:06:43 2021 +0200 Update .eslintrc.json commit 3c4b2e4823dbd8e9ca8dd332966bd10ac0fc098f Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Oct 27 15:08:32 2021 +0200 add nx library
This commit is contained in:
6
libs/ui/loader/loader-type.enum.ts
Normal file
6
libs/ui/loader/loader-type.enum.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum UiLoaderType {
|
||||
FULL_SCREEN = 'fullscreen',
|
||||
FULL_BLANK_SCREEN = 'full-blank-screen',
|
||||
ABSOLUTE = 'absolute',
|
||||
PADDED = 'padded',
|
||||
}
|
||||
4
libs/ui/loader/loader.component.html
Normal file
4
libs/ui/loader/loader.component.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div [ngClass]="loaderClass">
|
||||
asdf
|
||||
<digi-icon-spinner [ngClass]="spinnerClass"></digi-icon-spinner>
|
||||
</div>
|
||||
40
libs/ui/loader/loader.component.scss
Normal file
40
libs/ui/loader/loader.component.scss
Normal file
@@ -0,0 +1,40 @@
|
||||
@import 'mixins/backdrop';
|
||||
@import 'variables/gutters';
|
||||
@import 'variables/z-index';
|
||||
|
||||
@keyframes spinning {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.ui-loader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&--padded {
|
||||
padding: $digi--layout--gutter--l;
|
||||
}
|
||||
|
||||
&--absolute {
|
||||
@include msfa__backdrop($msfa__z-index-backdrop, false);
|
||||
}
|
||||
|
||||
&--full-screen {
|
||||
@include msfa__backdrop($msfa__z-index-backdrop);
|
||||
}
|
||||
|
||||
&--full-blank-screen {
|
||||
@include msfa__backdrop($msfa__z-index-backdrop, true, true);
|
||||
}
|
||||
|
||||
&__spinner {
|
||||
display: inline-flex;
|
||||
animation: spinning 1s linear infinite;
|
||||
|
||||
&--s {
|
||||
width: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
libs/ui/loader/loader.component.spec.ts
Normal file
26
libs/ui/loader/loader.component.spec.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LoaderComponent } from './loader.component';
|
||||
|
||||
describe('LoaderComponent', () => {
|
||||
let component: LoaderComponent;
|
||||
let fixture: ComponentFixture<LoaderComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [LoaderComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
15
libs/ui/loader/loader.component.stories.ts
Normal file
15
libs/ui/loader/loader.component.stories.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { LoaderComponent } from './loader.component';
|
||||
import { UiLoaderModule } from './loader.module';
|
||||
|
||||
export default { title: 'Loader', component: LoaderComponent };
|
||||
|
||||
const componentModule = {
|
||||
moduleMetadata: {
|
||||
imports: [UiLoaderModule],
|
||||
},
|
||||
};
|
||||
|
||||
export const standard = () => ({
|
||||
...componentModule,
|
||||
template: '<ui-loader></ui-loader>',
|
||||
});
|
||||
25
libs/ui/loader/loader.component.ts
Normal file
25
libs/ui/loader/loader.component.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { UiLoaderType } from './loader-type.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'ui-loader',
|
||||
templateUrl: './loader.component.html',
|
||||
styleUrls: ['./loader.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class LoaderComponent {
|
||||
private readonly _defaultClass = 'ui-loader';
|
||||
@Input() uiType: UiLoaderType = UiLoaderType.PADDED;
|
||||
@Input() uiSize: 's' | 'm' = 'm';
|
||||
|
||||
get loaderClass(): string {
|
||||
if (this.uiType) {
|
||||
return `${this._defaultClass} ${this._defaultClass}--${this.uiType as string}`;
|
||||
}
|
||||
return this._defaultClass;
|
||||
}
|
||||
|
||||
get spinnerClass(): string {
|
||||
return `${this._defaultClass}__spinner ${this._defaultClass}__spinner--${this.uiSize}`;
|
||||
}
|
||||
}
|
||||
11
libs/ui/loader/loader.module.ts
Normal file
11
libs/ui/loader/loader.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { LoaderComponent } from './loader.component';
|
||||
|
||||
@NgModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [LoaderComponent],
|
||||
imports: [CommonModule],
|
||||
exports: [LoaderComponent],
|
||||
})
|
||||
export class UiLoaderModule {}
|
||||
Reference in New Issue
Block a user